Nodes in a multi-machine cluster can be divided into master nodes and data nodes, using the Zen Discovery (Zen discovery) mechanism in the configuration file to manage different nodes. Zen Discovery is the default discovery mechanism that comes with ES, using multicast to discover other nodes. As soon as you start a new ES node and set the same name as the cluster, the node is added to the cluster.
Select 192.168.0.224 this machine as the master node, the configuration in Elasticsearch.yml is as follows:
cluster.namebropennode.namenode-224network.host0.0.0.0discovery.zen.ping.unicast.hosts192.168.0.224:9300discovery.zen.ping.multicast.enabledtrue
Note that the port is not 9200, but 9300. You can also not write ports.
Start the ES server on 192.168.0.224, and now it's just a single cluster.
Configure the same es,elasticsearch.yml in the 192.168.0.87 on this machine as follows:
cluster.namebropennode.namenode-87network.host0.0.0.0discovery.zen.ping.unicast.hosts192.168.0.224:9300discovery.zen.ping.multicast.enabledtrue
Then start es on the 192.168.0.87.
Visit http://192.168.0.224:9200/_plugin/head/
As shown, accessing the ES head plugin on the 192.168.0.224 server, you can see that the cluster named Bropen in ES has 4 nodes and 2 node-224,2 node-87.
The configuration was successful.
Elasticsearch Multi-machine cluster configuration