zen.asciidoc 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. [[modules-discovery-zen]]
  2. === Zen Discovery
  3. The zen discovery is the built in discovery module for elasticsearch and
  4. the default. It provides both multicast and unicast discovery as well
  5. being easily extended to support cloud environments.
  6. The zen discovery is integrated with other modules, for example, all
  7. communication between nodes is done using the
  8. <<modules-transport,transport>> module.
  9. It is separated into several sub modules, which are explained below:
  10. [float]
  11. [[ping]]
  12. ==== Ping
  13. This is the process where a node uses the discovery mechanisms to find
  14. other nodes. There is support for both multicast and unicast based
  15. discovery (these mechanisms can be used in conjunction as well).
  16. [float]
  17. [[multicast]]
  18. ===== Multicast
  19. Multicast ping discovery of other nodes is done by sending one or more
  20. multicast requests which existing nodes will receive and
  21. respond to. It provides the following settings with the
  22. `discovery.zen.ping.multicast` prefix:
  23. [cols="<,<",options="header",]
  24. |=======================================================================
  25. |Setting |Description
  26. |`group` |The group address to use. Defaults to `224.2.2.4`.
  27. |`port` |The port to use. Defaults to `54328`.
  28. |`ttl` |The ttl of the multicast message. Defaults to `3`.
  29. |`address` |The address to bind to, defaults to `null` which means it
  30. will bind `network.bind_host`
  31. |`enabled` |Whether multicast ping discovery is enabled. Defaults to `true`.
  32. |=======================================================================
  33. [float]
  34. [[unicast]]
  35. ===== Unicast
  36. The unicast discovery allows for discovery when multicast is
  37. not enabled. It basically requires a list of hosts to use that will act
  38. as gossip routers. It provides the following settings with the
  39. `discovery.zen.ping.unicast` prefix:
  40. [cols="<,<",options="header",]
  41. |=======================================================================
  42. |Setting |Description
  43. |`hosts` |Either an array setting or a comma delimited setting. Each
  44. value is either in the form of `host:port`, or in the form of
  45. `host[port1-port2]`.
  46. |=======================================================================
  47. The unicast discovery uses the
  48. <<modules-transport,transport>> module to
  49. perform the discovery.
  50. [float]
  51. [[master-election]]
  52. ==== Master Election
  53. As part of the ping process a master of the cluster is either
  54. elected or joined to. This is done automatically. The
  55. `discovery.zen.ping_timeout` (which defaults to `3s`) allows for the
  56. tweaking of election time to handle cases of slow or congested networks
  57. (higher values assure less chance of failure). Once a node joins, it
  58. will send a join request to the master (`discovery.zen.join_timeout`)
  59. with a timeout defaulting at 20 times the ping timeout.
  60. When the master node stops or has encountered a problem, the cluster nodes
  61. start pinging again and will elect a new master. This pinging round also
  62. serves as a protection against (partial) network failures where node may unjustly
  63. think that the master has failed. In this case the node will simply hear from
  64. other nodes about the currently active master.
  65. If `discovery.zen.master_election.filter_client` is `true`, pings from client nodes (nodes where `node.client` is
  66. `true`, or both `node.data` and `node.master` are `false`) are ignored during master election; the default value is
  67. `true`. If `discovery.zen.master_election.filter_data` is `true`, pings from non-master-eligible data nodes (nodes
  68. where `node.data` is `true` and `node.master` is `false`) are ignored during master election; the default value is
  69. `false`. Pings from master-eligible nodes are always observed during master election.
  70. Nodes can be excluded from becoming a master by setting `node.master` to
  71. `false`. Note, once a node is a client node (`node.client` set to
  72. `true`), it will not be allowed to become a master (`node.master` is
  73. automatically set to `false`).
  74. The `discovery.zen.minimum_master_nodes` sets the minimum
  75. number of master eligible nodes that need to join a newly elected master in order for an election to
  76. complete and for the elected node to accept it's mastership. The same setting controls the minimum number of
  77. active master eligible nodes that should be a part of any active cluster. If this requirement is not met the
  78. active master node will step down and a new mastser election will be begin.
  79. This setting must be set to a quorum of your master eligible nodes. It is recommended to avoid
  80. having only two master eligible nodes, since a quorum of two is two. Therefore, a loss
  81. of either master node will result in an inoperable cluster.
  82. [float]
  83. [[fault-detection]]
  84. ==== Fault Detection
  85. There are two fault detection processes running. The first is by the
  86. master, to ping all the other nodes in the cluster and verify that they
  87. are alive. And on the other end, each node pings to master to verify if
  88. its still alive or an election process needs to be initiated.
  89. The following settings control the fault detection process using the
  90. `discovery.zen.fd` prefix:
  91. [cols="<,<",options="header",]
  92. |=======================================================================
  93. |Setting |Description
  94. |`ping_interval` |How often a node gets pinged. Defaults to `1s`.
  95. |`ping_timeout` |How long to wait for a ping response, defaults to
  96. `30s`.
  97. |`ping_retries` |How many ping failures / timeouts cause a node to be
  98. considered failed. Defaults to `3`.
  99. |=======================================================================
  100. [float]
  101. ==== External Multicast
  102. The multicast discovery also supports external multicast requests to
  103. discover nodes. The external client can send a request to the multicast
  104. IP/group and port, in the form of:
  105. [source,js]
  106. --------------------------------------------------
  107. {
  108. "request" : {
  109. "cluster_name": "test_cluster"
  110. }
  111. }
  112. --------------------------------------------------
  113. And the response will be similar to node info response (with node level
  114. information only, including transport/http addresses, and node
  115. attributes):
  116. [source,js]
  117. --------------------------------------------------
  118. {
  119. "response" : {
  120. "cluster_name" : "test_cluster",
  121. "transport_address" : "...",
  122. "http_address" : "...",
  123. "attributes" : {
  124. "..."
  125. }
  126. }
  127. }
  128. --------------------------------------------------
  129. Note, it can still be enabled, with disabled internal multicast
  130. discovery, but still have external discovery working by keeping
  131. `discovery.zen.ping.multicast.enabled` set to `true` (the default), but,
  132. setting `discovery.zen.ping.multicast.ping.enabled` to `false`.
  133. [float]
  134. ==== Cluster state updates
  135. The master node is the only node in a cluster that can make changes to the
  136. cluster state. The master node processes one cluster state update at a time,
  137. applies the required changes and publishes the updated cluster state to all
  138. the other nodes in the cluster. Each node receives the publish message,
  139. updates its own cluster state and replies to the master node, which waits for
  140. all nodes to respond, up to a timeout, before going ahead processing the next
  141. updates in the queue. The `discovery.zen.publish_timeout` is set by default
  142. to 30 seconds and can be changed dynamically through the
  143. <<cluster-update-settings,cluster update settings api>>
  144. [float]
  145. [[no-master-block]]
  146. ==== No master block
  147. For the cluster to be fully operational, it must have an active master and the
  148. number of running master eligible nodes must satisfy the
  149. `discovery.zen.minimum_master_nodes` setting if set. The
  150. `discovery.zen.no_master_block` settings controls what operations should be
  151. rejected when there is no active master.
  152. The `discovery.zen.no_master_block` setting has two valid options:
  153. [horizontal]
  154. `all`:: All operations on the node--i.e. both read & writes--will be rejected. This also applies for api cluster state
  155. read or write operations, like the get index settings, put mapping and cluster state api.
  156. `write`:: (default) Write operations will be rejected. Read operations will succeed, based on the last known cluster configuration.
  157. This may result in partial reads of stale data as this node may be isolated from the rest of the cluster.
  158. The `discovery.zen.no_master_block` setting doesn't apply to nodes based apis (for example cluster stats, node info and
  159. node stats apis) which will not be blocked and try to execute on any node possible.