Elasticsearch集群
1、两台机分别安装好Elasticsearch
其中为192.168.1.110,设为master节点,elasticsearch.yml配置如下
|
1
2
3
4
5
6
7
8
9
10
11
12
|
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配置如下:
|
1
2
3
4
5
6
7
8
9
10
11
12
|
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:
从的:
注:
如果另一台机直接复制前一台机;
启动后可能出现:
|
1
|
[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文件下的文件清空。
本文转自yunlielai51CTO博客,原文链接:http://blog.51cto.com/4925054/2084176,如需转载请自行联系原作者

