下载elasticSearch-5.5.1复制两份
命名为elasticSearch-5.5.1_n1 和 elasticSearch-5.5.1_n2
在各自的目录下面建立 logs 和 data
修改配置文件如下
n1配置
cluster.name: elasticsearch
cluster.routing.allocation.same_shard.host: true
node.name: n1
node.master: true
node.data: true
path.data: E:\soft_home\elasticsearch-5.5.1_n1\data
path.logs: E:\soft_home\elasticsearch-5.5.1_n1\logs
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.2.142:9300","192.168.2.142:9301"]
n2配置
cluster.name: elasticsearch
cluster.routing.allocation.same_shard.host: true
node.name: n2
node.master: false
node.data: true
path.data: E:\soft_home\elasticsearch-5.5.1_n2\data
path.logs: E:\soft_home\elasticsearch-5.5.1_n2\logs
network.host: 0.0.0.0
http.port: 9201
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["192.168.2.142:9300","192.168.2.142:9301"]
依次启动n1,n2 即可
注:主要强调下discovery.zen.ping.unicast.hosts 一定要配置否则n1和n2没有啥关系,各耍各的