Because of the limited machine, this article only makes the cluster test of 3 nodes in a single machine.
1. Cluster test information
Elasticsearch version: elasticsearch-2.4.1
Windowns version: Win10
2, decompression elasticsearch-2.4.1.zip to any directory, install Elasticsearch-head plug-in.
Execute command in ${eshome}\bin directory: Plugin install Mobz/elasticsearch-head
3. After a single node is started, you can view the following information (effect after adding data)
4, the Elasticsearch copy 3 copies, respectively named Elasticsearch-2.4.1-1, Elasticsearch-2.4.1-2, elasticsearch-2.4.1-3
5, modify the configuration information of each node
1) Modify the ELASTICSEARCH-2.4.1-1\CONFIG\ELASTICSEARCH.YML and add the following information:
Cluster.name:elasticsearchnode.name:node-1node.master:truenode.data:truenetwork.host:127.0.0.1http.port: 9201transport.tcp.port:9301discovery.zen.ping.multicast.enabled:falsediscovery.zen.ping.timeout: 40sdiscovery.zen.ping.unicast.hosts: ["127.0.0.1:9301", "127.0.0.1:9302", "127.0.0.1:9303"]
2) Modify the ELASTICSEARCH-2.4.1-2\CONFIG\ELASTICSEARCH.YML and add the following information:
Cluster.name:elasticsearchnode.name:node-2node.master:truenode.data:truenetwork.host:127.0.0.1http.port: 9202transport.tcp.port:9302discovery.zen.ping.multicast.enabled:falsediscovery.zen.ping.timeout: 40sdiscovery.zen.ping.unicast.hosts: ["127.0.0.1:9301", "127.0.0.1:9302", "127.0.0.1:9303"]
3) Modify the ELASTICSEARCH-2.4.1-3\CONFIG\ELASTICSEARCH.YML and add the following information:
Node.name:node-3node.master:truenode.data:truenetwork.host:127.0.0.1http.port:9203transport.tcp.port: 9303discovery.zen.ping.multicast.enabled:falsediscovery.zen.ping.timeout:40sdiscovery.zen.ping.unicast.hosts: [ "127.0.0.1:9301", "127.0.0.1:9302", "127.0.0.1:9303"]
6, login any one node, you can see the following information:
3 indexes of data are distributed to 3 nodes, each shard has 2 backups, and Node-2 is the master service.
7, close the node node-3, the first 2 nodes can see the following information (waiting for a period of time):
The shards are transferred to the node-1 and NODE-2 nodes.
8. Reopen the Node-3 node, and the data is evenly divided into 3 nodes.
Elasticsearch cluster configuration