zen.asciidoc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 unicast discovery, but can be extended to
  5. support cloud environments and other forms of discovery.
  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.
  15. [float]
  16. [[unicast]]
  17. ===== Unicast
  18. Unicast discovery requires a list of hosts to use that will act as gossip routers. These hosts can be specified as
  19. hostnames or IP addresses; hosts specified as hostnames are resolved to IP addresses during each round of pinging. Note
  20. that with the Java security manager in place, the JVM defaults to caching positive hostname resolutions indefinitely.
  21. This can be modified by adding
  22. http://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.html[`networkaddress.cache.ttl=<timeout>`] to your
  23. http://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html[Java security policy]. Any hosts that
  24. fail to resolve will be logged. Note also that with the Java security manager in place, the JVM defaults to caching
  25. negative hostname resolutions for ten seconds. This can be modified by adding
  26. http://docs.oracle.com/javase/8/docs/technotes/guides/net/properties.html[`networkaddress.cache.negative.ttl=<timeout>`]
  27. to your http://docs.oracle.com/javase/8/docs/technotes/guides/security/PolicyFiles.html[Java security policy].
  28. Unicast discovery provides the following settings with the `discovery.zen.ping.unicast` prefix:
  29. [cols="<,<",options="header",]
  30. |=======================================================================
  31. |Setting |Description
  32. |`hosts` |Either an array setting or a comma delimited setting. Each
  33. value should be in the form of `host:port` or `host` (where `port` defaults to the setting `transport.profiles.default.port`
  34. falling back to `transport.tcp.port` if not set). Note that IPv6 hosts must be bracketed. Defaults to `127.0.0.1, [::1]`
  35. |`hosts.resolve_timeout` |The amount of time to wait for DNS lookups on each round of pinging. Specified as
  36. <<time-units, time units>>. Defaults to 5s.
  37. |=======================================================================
  38. The unicast discovery uses the <<modules-transport,transport>> module to perform the discovery.
  39. [float]
  40. [[master-election]]
  41. ==== Master Election
  42. As part of the ping process a master of the cluster is either
  43. elected or joined to. This is done automatically. The
  44. `discovery.zen.ping_timeout` (which defaults to `3s`) allows for the
  45. tweaking of election time to handle cases of slow or congested networks
  46. (higher values assure less chance of failure). Once a node joins, it
  47. will send a join request to the master (`discovery.zen.join_timeout`)
  48. with a timeout defaulting at 20 times the ping timeout.
  49. When the master node stops or has encountered a problem, the cluster nodes
  50. start pinging again and will elect a new master. This pinging round also
  51. serves as a protection against (partial) network failures where a node may unjustly
  52. think that the master has failed. In this case the node will simply hear from
  53. other nodes about the currently active master.
  54. If `discovery.zen.master_election.ignore_non_master_pings` is `true`, pings from nodes that are not master
  55. eligible (nodes where `node.master` is `false`) are ignored during master election; the default value is
  56. `false`.
  57. Nodes can be excluded from becoming a master by setting `node.master` to `false`.
  58. The `discovery.zen.minimum_master_nodes` sets the minimum
  59. number of master eligible nodes that need to join a newly elected master in order for an election to
  60. complete and for the elected node to accept its mastership. The same setting controls the minimum number of
  61. active master eligible nodes that should be a part of any active cluster. If this requirement is not met the
  62. active master node will step down and a new master election will begin.
  63. This setting must be set to a <<minimum_master_nodes,quorum>> of your master
  64. eligible nodes. It is recommended to avoid having only two master eligible
  65. nodes, since a quorum of two is two. Therefore, a loss of either master
  66. eligible node will result in an inoperable cluster.
  67. [float]
  68. [[fault-detection]]
  69. ==== Fault Detection
  70. There are two fault detection processes running. The first is by the
  71. master, to ping all the other nodes in the cluster and verify that they
  72. are alive. And on the other end, each node pings to master to verify if
  73. its still alive or an election process needs to be initiated.
  74. The following settings control the fault detection process using the
  75. `discovery.zen.fd` prefix:
  76. [cols="<,<",options="header",]
  77. |=======================================================================
  78. |Setting |Description
  79. |`ping_interval` |How often a node gets pinged. Defaults to `1s`.
  80. |`ping_timeout` |How long to wait for a ping response, defaults to
  81. `30s`.
  82. |`ping_retries` |How many ping failures / timeouts cause a node to be
  83. considered failed. Defaults to `3`.
  84. |=======================================================================
  85. [float]
  86. ==== Cluster state updates
  87. The master node is the only node in a cluster that can make changes to the
  88. cluster state. The master node processes one cluster state update at a time,
  89. applies the required changes and publishes the updated cluster state to all
  90. the other nodes in the cluster. Each node receives the publish message, acknowledges
  91. it, but does *not* yet apply it. If the master does not receive acknowledgement from
  92. at least `discovery.zen.minimum_master_nodes` nodes within a certain time (controlled by
  93. the `discovery.zen.commit_timeout` setting and defaults to 30 seconds) the cluster state
  94. change is rejected.
  95. Once enough nodes have responded, the cluster state is committed and a message will
  96. be sent to all the nodes. The nodes then proceed to apply the new cluster state to their
  97. internal state. The master node waits for all nodes to respond, up to a timeout, before
  98. going ahead processing the next updates in the queue. The `discovery.zen.publish_timeout` is
  99. set by default to 30 seconds and is measured from the moment the publishing started. Both
  100. timeout settings can be changed dynamically through the <<cluster-update-settings,cluster update settings api>>
  101. [float]
  102. [[no-master-block]]
  103. ==== No master block
  104. For the cluster to be fully operational, it must have an active master and the
  105. number of running master eligible nodes must satisfy the
  106. `discovery.zen.minimum_master_nodes` setting if set. The
  107. `discovery.zen.no_master_block` settings controls what operations should be
  108. rejected when there is no active master.
  109. The `discovery.zen.no_master_block` setting has two valid options:
  110. [horizontal]
  111. `all`:: All operations on the node--i.e. both read & writes--will be rejected. This also applies for api cluster state
  112. read or write operations, like the get index settings, put mapping and cluster state api.
  113. `write`:: (default) Write operations will be rejected. Read operations will succeed, based on the last known cluster configuration.
  114. This may result in partial reads of stale data as this node may be isolated from the rest of the cluster.
  115. The `discovery.zen.no_master_block` setting doesn't apply to nodes-based apis (for example cluster stats, node info and
  116. node stats apis). Requests to these apis will not be blocked and can run on any available node.