1、两台机分别安装好Elasticsearch
其中为192.168.1.110,设为master节点,elasticsearch.yml配置如下
cluster.name: my-application node.name: node-111 network.host: 192.168.1.110 http.port: 9200 http.cors.enabled: true http.cors.allow-origin: "*" node.master: true node.data: true discovery.zen.ping.unicast.hosts: ["192.168.1.110"]
另一台机:的ip位192.168.1.108,elasticsearch.yml配置如下:
cluster.name: my-application node.name: node-102 network.host: 192.168.1.108 http.port: 9200 http.cors.enabled: true http.cors.allow-origin: "*" node.master: false node.data: true discovery.zen.ping.unicast.hosts: ["192.168.1.110"]
分别启动两台机
访问head:
master:
从的:
注:
如果另一台机直接复制前一台机;
启动后可能出现:
[node-2] failed to send join request to master [{node-1}{WbcP0pC_T32jWpYvu5is1A}{2_LCVHx1QEaBZYZ7XQEkMg}{10.10.11.200}{10.10.11.200:9300}], reason [RemoteTransportException[[node-1][10.10.11.200:9300][internal:discovery/zen/join]]; nested: IllegalArgumentException[can't add node {node-2}{WbcP0pC_T32jWpYvu5is1A}{p-HCgFLvSFa
解决:
原因是:是因为复制的elasticsearch文件夹下包含了data文件中示例一的节点数据,需要把示例二data文件下的文件清空。
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/193065.html