zen.asciidoc 7.3 KB

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