| 123456789101112131415161718192021222324252627282930313233343536373839404142 | [[cluster-state-publishing]]=== Publishing the cluster stateThe master node is the only node in a cluster that can make changes to thecluster state. The master node processes one batch of cluster state updates ata time, computing the required changes and publishing the updated cluster stateto all the other nodes in the cluster. Each publication starts with the masterbroadcasting the updated cluster state to all nodes in the cluster.  Each noderesponds with an acknowledgement but does not yet apply the newly-receivedstate. Once the master has collected acknowledgements from enoughmaster-eligible nodes, the new cluster state is said to be _committed_ and themaster broadcasts another message instructing nodes to apply the now-committedstate. Each node receives this message, applies the updated state, and thensends a second acknowledgement back to the master.The master allows a limited amount of time for each cluster state update to becompletely published to all nodes. It is defined by the`cluster.publish.timeout` setting, which defaults to `30s`, measured from thetime the publication started. If this time is reached before the new clusterstate is committed then the cluster state change is rejected and the masterconsiders itself to have failed. It stands down and starts trying to elect anew master.If the new cluster state is committed before `cluster.publish.timeout` haselapsed, the master node considers the change to have succeeded. It waits untilthe timeout has elapsed or until it has received acknowledgements that eachnode in the cluster has applied the updated state, and then starts processingand publishing the next cluster state update. If some acknowledgements have notbeen received (i.e. some nodes have not yet confirmed that they have appliedthe current update), these nodes are said to be _lagging_ since their clusterstates have fallen behind the master's latest state. The master waits for thelagging nodes to catch up for a further time, `cluster.follower_lag.timeout`,which defaults to `90s`. If a node has still not successfully applied thecluster state update within this time then it is considered to have failed andis removed from the cluster.NOTE: {es} is a peer to peer based system, in which nodes communicate with oneanother directly. The high-throughput APIs (index, delete, search) do notnormally interact with the master node. The responsibility of the master nodeis to maintain the global cluster state and reassign shards when nodes join orleave the cluster. Each time the cluster state is changed, the new state ispublished to all nodes in the cluster as described above.
 |