publishing.asciidoc 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. [[cluster-state-overview]]
  2. === Cluster state
  3. The _cluster state_ is an internal data structure which keeps track of a
  4. variety of information needed by every node, including:
  5. * The identity and attributes of the other nodes in the cluster
  6. * Cluster-wide settings
  7. * Index metadata, including the mapping and settings for each index
  8. * The location and status of every shard copy in the cluster
  9. The elected master node ensures that every node in the cluster has a copy of
  10. the same cluster state. The <<cluster-state,cluster state API>> lets you retrieve a
  11. representation of this internal state for debugging or diagnostic purposes.
  12. [[cluster-state-publishing]]
  13. ==== Publishing the cluster state
  14. The elected master node is the only node in a cluster that can make changes to
  15. the cluster state. The elected master node processes one batch of cluster state
  16. updates at a time, computing the required changes and publishing the updated
  17. cluster state to all the other nodes in the cluster. Each publication starts
  18. with the elected master broadcasting the updated cluster state to all nodes in
  19. the cluster. Each node responds with an acknowledgement but does not yet apply
  20. the newly-received state. Once the elected master has collected
  21. acknowledgements from enough master-eligible nodes, the new cluster state is
  22. said to be _committed_ and the master broadcasts another message instructing
  23. nodes to apply the now-committed state. Each node receives this message,
  24. applies the updated state, and then sends a second acknowledgement back to the
  25. master.
  26. The elected master allows a limited amount of time for each cluster state
  27. update to be completely published to all nodes. It is defined by the
  28. `cluster.publish.timeout` setting, which defaults to `30s`, measured from the
  29. time the publication started. If this time is reached before the new cluster
  30. state is committed then the cluster state change is rejected and the elected
  31. master considers itself to have failed. It stands down and starts trying to
  32. elect a new master node.
  33. If the new cluster state is committed before `cluster.publish.timeout` has
  34. elapsed, the elected master node considers the change to have succeeded. It
  35. waits until the timeout has elapsed or until it has received acknowledgements
  36. that each node in the cluster has applied the updated state, and then starts
  37. processing and publishing the next cluster state update. If some
  38. acknowledgements have not been received (i.e. some nodes have not yet confirmed
  39. that they have applied the current update), these nodes are said to be
  40. _lagging_ since their cluster states have fallen behind the elected master's
  41. latest state. The elected master waits for the lagging nodes to catch up for a
  42. further time, `cluster.follower_lag.timeout`, which defaults to `90s`. If a
  43. node has still not successfully applied the cluster state update within this
  44. time then it is considered to have failed and the elected master removes it
  45. from the cluster.
  46. Cluster state updates are typically published as diffs to the previous cluster
  47. state, which reduces the time and network bandwidth needed to publish a cluster
  48. state update. For example, when updating the mappings for only a subset of the
  49. indices in the cluster state, only the updates for those indices need to be
  50. published to the nodes in the cluster, as long as those nodes have the previous
  51. cluster state. If a node is missing the previous cluster state, for example
  52. when rejoining a cluster, the elected master will publish the full cluster
  53. state to that node so that it can receive future updates as diffs.
  54. NOTE: {es} is a peer to peer based system, in which nodes communicate with one
  55. another directly. The high-throughput APIs (index, delete, search) do not
  56. normally interact with the elected master node. The responsibility of the
  57. elected master node is to maintain the global cluster state which includes
  58. reassigning shards when nodes join or leave the cluster. Each time the cluster
  59. state is changed, the new state is published to all nodes in the cluster as
  60. described above.
  61. The performance characteristics of cluster state updates are a function of the
  62. speed of the storage on each master-eligible node, as well as the reliability
  63. and latency of the network interconnections between all nodes in the cluster.
  64. You must therefore ensure that the storage and networking available to the
  65. nodes in your cluster are good enough to meet your performance goals.
  66. [[dangling-index]]
  67. ==== Dangling indices
  68. When a node joins the cluster, if it finds any shards stored in its local
  69. data directory that do not already exist in the cluster state, it will consider
  70. those shards to belong to a "dangling" index. You can list, import or
  71. delete dangling indices using the <<dangling-indices-api,Dangling indices
  72. API>>.
  73. NOTE: The API cannot offer any guarantees as to whether the imported data
  74. truly represents the latest state of the data when the index was still part
  75. of the cluster.