分別在3臺機器上安裝 elasticsearch, ip 分別爲 node
192.168.48.137, 192.168.48.138, 192.168.48.140bash
配置 elasticsearch.ymlapp
192.168.48.137 機器配置
cluster.name: my-application
node.name: node-137
#指定了該節點可能成爲 master 節點,還能夠是數據節點
node.master: true
node.data: true
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.48.137", "192.168.48.138", "192.168.48.140"]
192.168.48.138 機器配置
cluster.name: my-application
node.name: node-138
#指定了該節點可能成爲 master 節點,還能夠是數據節點
node.master: true
node.data: true
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.48.137", "192.168.48.138", "192.168.48.140"]
192.168.48.140 機器配置
cluster.name: my-application
node.name: node-140
#指定了該節點可能成爲 master 節點,還能夠是數據節點
node.master: true
node.data: true
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.48.137", "192.168.48.138", "192.168.48.140"]
------------------------------curl
改完配置以後重啓 elasticsearchelasticsearch
systemctl restart elasticsearch.service
在 138, 140 機器上 查看當前節點的全部Indextcp
curl -X GET 'http://localhost:9200/_cat/indices?v'
顯示以下,說明集羣搭建成功,數據已同步url

集羣搭建完成。rest