zen.asciidoc 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 to all available network interfaces.
  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. Nodes can be excluded from becoming a master by setting `node.master` to
  66. `false`. Note, once a node is a client node (`node.client` set to
  67. `true`), it will not be allowed to become a master (`node.master` is
  68. automatically set to `false`).
  69. The `discovery.zen.minimum_master_nodes` sets the minimum
  70. number of master eligible nodes that need to join a newly elected master in order for an election to
  71. complete and for the elected node to accept it's mastership. The same setting controls the minimum number of
  72. active master eligible nodes that should be a part of any active cluster. If this requirement is not met the
  73. active master node will step down and a new mastser election will be begin.
  74. This setting must be set to a quorum of your master eligible nodes. It is recommended to avoid
  75. having only two master eligible nodes, since a quorum of two is two. Therefore, a loss
  76. of either master node will result in an inoperable cluster.
  77. [float]
  78. [[fault-detection]]
  79. ==== Fault Detection
  80. There are two fault detection processes running. The first is by the
  81. master, to ping all the other nodes in the cluster and verify that they
  82. are alive. And on the other end, each node pings to master to verify if
  83. its still alive or an election process needs to be initiated.
  84. The following settings control the fault detection process using the
  85. `discovery.zen.fd` prefix:
  86. [cols="<,<",options="header",]
  87. |=======================================================================
  88. |Setting |Description
  89. |`ping_interval` |How often a node gets pinged. Defaults to `1s`.
  90. |`ping_timeout` |How long to wait for a ping response, defaults to
  91. `30s`.
  92. |`ping_retries` |How many ping failures / timeouts cause a node to be
  93. considered failed. Defaults to `3`.
  94. |=======================================================================
  95. [float]
  96. ==== External Multicast
  97. The multicast discovery also supports external multicast requests to
  98. discover nodes. The external client can send a request to the multicast
  99. IP/group and port, in the form of:
  100. [source,js]
  101. --------------------------------------------------
  102. {
  103. "request" : {
  104. "cluster_name": "test_cluster"
  105. }
  106. }
  107. --------------------------------------------------
  108. And the response will be similar to node info response (with node level
  109. information only, including transport/http addresses, and node
  110. attributes):
  111. [source,js]
  112. --------------------------------------------------
  113. {
  114. "response" : {
  115. "cluster_name" : "test_cluster",
  116. "transport_address" : "...",
  117. "http_address" : "...",
  118. "attributes" : {
  119. "..."
  120. }
  121. }
  122. }
  123. --------------------------------------------------
  124. Note, it can still be enabled, with disabled internal multicast
  125. discovery, but still have external discovery working by keeping
  126. `discovery.zen.ping.multicast.enabled` set to `true` (the default), but,
  127. setting `discovery.zen.ping.multicast.ping.enabled` to `false`.
  128. [float]
  129. ==== Cluster state updates
  130. The master node is the only node in a cluster that can make changes to the
  131. cluster state. The master node processes one cluster state update at a time,
  132. applies the required changes and publishes the updated cluster state to all
  133. the other nodes in the cluster. Each node receives the publish message,
  134. updates its own cluster state and replies to the master node, which waits for
  135. all nodes to respond, up to a timeout, before going ahead processing the next
  136. updates in the queue. The `discovery.zen.publish_timeout` is set by default
  137. to 30 seconds and can be changed dynamically through the
  138. <<cluster-update-settings,cluster update settings api>>
  139. [float]
  140. [[no-master-block]]
  141. ==== No master block
  142. For the cluster to be fully operational, it must have an active master and the
  143. number of running master eligible nodes must satisfy the
  144. `discovery.zen.minimum_master_nodes` setting if set. The
  145. `discovery.zen.no_master_block` settings controls what operations should be
  146. rejected when there is no active master.
  147. The `discovery.zen.no_master_block` setting has two valid options:
  148. [horizontal]
  149. `all`:: All operations on the node--i.e. both read & writes--will be rejected. This also applies for api cluster state
  150. read or write operations, like the get index settings, put mapping and cluster state api.
  151. `write`:: (default) Write operations will be rejected. Read operations will succeed, based on the last known cluster configuration.
  152. This may result in partial reads of stale data as this node may be isolated from the rest of the cluster.
  153. The `discovery.zen.no_master_block` setting doesn't apply to nodes based apis (for example cluster stats, node info and
  154. node stats apis) which will not be blocked and try to execute on any node possible.