1、安裝環(huán)境與版本:
3個CentOS 7 虛擬機
3個ElasticSearch 實例
centos-100 | centos-101 | centos-102 |
---|
2、修改配置
vi /usr/java/elasticsearch/config/elasticsearch.yml
cluster.name: panqt-es
node.name: node-centos-100
node.master: true
node.data: true
network.host: centos-100 #本機ip
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["centos-100", "centos-101", "centos-102"]
discovery.zen.minimum_master_nodes: 2 #(候選主節(jié)點數(shù) / 2) + 1
啟動所有節(jié)點
日志報錯:failed to send join request to master
3、測試
$ curl -XGET 'http://centos-100:9200/_cat/nodes?pretty'
[root@centos-100 panqt]# curl -XGET 'http://centos-100:9200/_cat/nodes?pretty'
192.168.200.100 12 94 38 1.08 0.56 0.52 mdi - node-centos-100
192.168.200.101 13 95 47 0.92 0.51 0.48 mdi * node-centos-101 # * 表示主節(jié)點
192.168.200.102 12 95 51 0.95 0.49 0.47 mdi - node-centos-101