As detailed earlier, a node in Elasticsearch is one of the servers forming the cluster. A node in a cluster can be configured to work as different node types as follows:
- Master node
- Data node
- Client node
Any node in a cluster is eligible to become the master node if the node.master property is set to true in the elasticsearch.yml
file. Once the master node is elected automatically by the cluster, this node is entrusted with some key responsibilities, as follows:
- Allocate of shards across various nodes within the cluster.
- Create and delete indexes.
- Broadcast the cluster state to all the nodes in the cluster and in turn receives confirmations from each of those nodes back.
- Take necessary actions when a node joins or leaves the cluster.
- Ping all the nodes periodically and all nodes ping back the master periodically. If the master fails due to any reason, one of the other master-eligible nodes is elected as master by the cluster.