node.asciidoc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. [[modules-node]]
  2. == Node
  3. Any time that you start an instance of Elasticsearch, you are starting a
  4. _node_. A collection of connected nodes is called a
  5. <<modules-cluster,cluster>>. If you are running a single node of Elasticsearch,
  6. then you have a cluster of one node.
  7. Every node in the cluster can handle <<modules-http,HTTP>> and
  8. <<modules-transport,Transport>> traffic by default. The transport layer
  9. is used exclusively for communication between nodes; the HTTP layer is
  10. used by REST clients.
  11. All nodes know about all the other nodes in the cluster and can forward client
  12. requests to the appropriate node. Besides that, each node serves one or more
  13. purpose:
  14. <<master-node,Master-eligible node>>::
  15. A node that has `node.master` set to `true` (default), which makes it eligible
  16. to be <<modules-discovery,elected as the _master_ node>>, which controls
  17. the cluster.
  18. <<data-node,Data node>>::
  19. A node that has `node.data` set to `true` (default). Data nodes hold data and
  20. perform data related operations such as CRUD, search, and aggregations.
  21. <<ingest,Ingest node>>::
  22. A node that has `node.ingest` set to `true` (default). Ingest nodes are able
  23. to apply an <<pipeline,ingest pipeline>> to a document in order to transform
  24. and enrich the document before indexing. With a heavy ingest load, it makes
  25. sense to use dedicated ingest nodes and to mark the master and data nodes as
  26. `node.ingest: false`.
  27. [NOTE]
  28. [[coordinating-node]]
  29. .Coordinating node
  30. ===============================================
  31. Requests like search requests or bulk-indexing requests may involve data held
  32. on different data nodes. A search request, for example, is executed in two
  33. phases which are coordinated by the node which receives the client request --
  34. the _coordinating node_.
  35. In the _scatter_ phase, the coordinating node forwards the request to the data
  36. nodes which hold the data. Each data node executes the request locally and
  37. returns its results to the coordinating node. In the _gather_ phase, the
  38. coordinating node reduces each data node's results into a single global
  39. resultset.
  40. Every node is implicitly a coordinating node. This means that a node that has
  41. all three `node.master`, `node.data` and `node.ingest` set to `false` will
  42. only act as a coordinating node, which cannot be disabled. As a result, such
  43. a node needs to have enough memory and CPU in order to deal with the gather
  44. phase.
  45. ===============================================
  46. [float]
  47. [[master-node]]
  48. === Master Eligible Node
  49. The master node is responsible for lightweight cluster-wide actions such as
  50. creating or deleting an index, tracking which nodes are part of the cluster,
  51. and deciding which shards to allocate to which nodes. It is important for
  52. cluster health to have a stable master node.
  53. Any master-eligible node (all nodes by default) may be elected to become the
  54. master node by the <<modules-discovery,master election process>>.
  55. IMPORTANT: Master nodes must have access to the `data/` directory (just like
  56. `data` nodes) as this is where the cluster state is persisted between node restarts.
  57. Indexing and searching your data is CPU-, memory-, and I/O-intensive work
  58. which can put pressure on a node's resources. To ensure that your master
  59. node is stable and not under pressure, it is a good idea in a bigger
  60. cluster to split the roles between dedicated master-eligible nodes and
  61. dedicated data nodes.
  62. While master nodes can also behave as <<coordinating-node,coordinating nodes>>
  63. and route search and indexing requests from clients to data nodes, it is
  64. better _not_ to use dedicated master nodes for this purpose. It is important
  65. for the stability of the cluster that master-eligible nodes do as little work
  66. as possible.
  67. To create a dedicated master-eligible node, set:
  68. [source,yaml]
  69. -------------------
  70. node.master: true <1>
  71. node.data: false <2>
  72. node.ingest: false <3>
  73. cluster.remote.connect: false <4>
  74. -------------------
  75. <1> The `node.master` role is enabled by default.
  76. <2> Disable the `node.data` role (enabled by default).
  77. <3> Disable the `node.ingest` role (enabled by default).
  78. <4> Disable {ccs} (enabled by default).
  79. ifdef::include-xpack[]
  80. NOTE: These settings apply only when {xpack} is not installed. To create a
  81. dedicated master-eligible node when {xpack} is installed, see <<modules-node-xpack,{xpack} node settings>>.
  82. endif::include-xpack[]
  83. [float]
  84. [[data-node]]
  85. === Data Node
  86. Data nodes hold the shards that contain the documents you have indexed. Data
  87. nodes handle data related operations like CRUD, search, and aggregations.
  88. These operations are I/O-, memory-, and CPU-intensive. It is important to
  89. monitor these resources and to add more data nodes if they are overloaded.
  90. The main benefit of having dedicated data nodes is the separation of the
  91. master and data roles.
  92. To create a dedicated data node, set:
  93. [source,yaml]
  94. -------------------
  95. node.master: false <1>
  96. node.data: true <2>
  97. node.ingest: false <3>
  98. cluster.remote.connect: false <4>
  99. -------------------
  100. <1> Disable the `node.master` role (enabled by default).
  101. <2> The `node.data` role is enabled by default.
  102. <3> Disable the `node.ingest` role (enabled by default).
  103. <4> Disable {ccs} (enabled by default).
  104. ifdef::include-xpack[]
  105. NOTE: These settings apply only when {xpack} is not installed. To create a
  106. dedicated data node when {xpack} is installed, see <<modules-node-xpack,{xpack} node settings>>.
  107. endif::include-xpack[]
  108. [float]
  109. [[node-ingest-node]]
  110. === Ingest Node
  111. Ingest nodes can execute pre-processing pipelines, composed of one or more
  112. ingest processors. Depending on the type of operations performed by the ingest
  113. processors and the required resources, it may make sense to have dedicated
  114. ingest nodes, that will only perform this specific task.
  115. To create a dedicated ingest node, set:
  116. [source,yaml]
  117. -------------------
  118. node.master: false <1>
  119. node.data: false <2>
  120. node.ingest: true <3>
  121. cluster.remote.connect: false <4>
  122. -------------------
  123. <1> Disable the `node.master` role (enabled by default).
  124. <2> Disable the `node.data` role (enabled by default).
  125. <3> The `node.ingest` role is enabled by default.
  126. <4> Disable {ccs} (enabled by default).
  127. ifdef::include-xpack[]
  128. NOTE: These settings apply only when {xpack} is not installed. To create a
  129. dedicated ingest node when {xpack} is installed, see <<modules-node-xpack,{xpack} node settings>>.
  130. endif::include-xpack[]
  131. [float]
  132. [[coordinating-only-node]]
  133. === Coordinating only node
  134. If you take away the ability to be able to handle master duties, to hold data,
  135. and pre-process documents, then you are left with a _coordinating_ node that
  136. can only route requests, handle the search reduce phase, and distribute bulk
  137. indexing. Essentially, coordinating only nodes behave as smart load balancers.
  138. Coordinating only nodes can benefit large clusters by offloading the
  139. coordinating node role from data and master-eligible nodes. They join the
  140. cluster and receive the full <<cluster-state,cluster state>>, like every other
  141. node, and they use the cluster state to route requests directly to the
  142. appropriate place(s).
  143. WARNING: Adding too many coordinating only nodes to a cluster can increase the
  144. burden on the entire cluster because the elected master node must await
  145. acknowledgement of cluster state updates from every node! The benefit of
  146. coordinating only nodes should not be overstated -- data nodes can happily
  147. serve the same purpose.
  148. To create a dedicated coordinating node, set:
  149. [source,yaml]
  150. -------------------
  151. node.master: false <1>
  152. node.data: false <2>
  153. node.ingest: false <3>
  154. cluster.remote.connect: false <4>
  155. -------------------
  156. <1> Disable the `node.master` role (enabled by default).
  157. <2> Disable the `node.data` role (enabled by default).
  158. <3> Disable the `node.ingest` role (enabled by default).
  159. <4> Disable {ccs} (enabled by default).
  160. ifdef::include-xpack[]
  161. NOTE: These settings apply only when {xpack} is not installed. To create a
  162. dedicated coordinating node when {xpack} is installed, see <<modules-node-xpack,{xpack} node settings>>.
  163. endif::include-xpack[]
  164. [float]
  165. [[change-node-role]]
  166. === Changing the role of a node
  167. Each data node maintains the following data on disk:
  168. * the shard data for every shard allocated to that node,
  169. * the index metadata corresponding with every shard allocated to that node, and
  170. * the cluster-wide metadata, such as settings and index templates.
  171. Similarly, each master-eligible node maintains the following data on disk:
  172. * the index metadata for every index in the cluster, and
  173. * the cluster-wide metadata, such as settings and index templates.
  174. Each node checks the contents of its data path at startup. If it discovers
  175. unexpected data then it will refuse to start. This is to avoid importing
  176. unwanted <<modules-gateway-dangling-indices,dangling indices>> which can lead
  177. to a red cluster health. To be more precise, nodes with `node.data: false` will
  178. refuse to start if they find any shard data on disk at startup, and nodes with
  179. both `node.master: false` and `node.data: false` will refuse to start if they
  180. have any index metadata on disk at startup.
  181. It is possible to change the roles of a node by adjusting its
  182. `elasticsearch.yml` file and restarting it. This is known as _repurposing_ a
  183. node. In order to satisfy the checks for unexpected data described above, you
  184. must perform some extra steps to prepare a node for repurposing when setting
  185. its `node.data` or `node.master` roles to `false`:
  186. * If you want to repurpose a data node by changing `node.data` to `false` then
  187. you should first use an <<allocation-filtering,allocation filter>> to safely
  188. migrate all the shard data onto other nodes in the cluster.
  189. * If you want to repurpose a node to have both `node.master: false` and
  190. `node.data: false` then it is simplest to start a brand-new node with an
  191. empty data path and the desired roles. You may find it safest to use an
  192. <<allocation-filtering,allocation filter>> to migrate the shard data
  193. elsewhere in the cluster first.
  194. If it is not possible to follow these extra steps then you may be able to use
  195. the <<node-tool-repurpose,`elasticsearch-node repurpose`>> tool to delete any
  196. excess data that prevents a node from starting.
  197. [float]
  198. == Node data path settings
  199. [float]
  200. [[data-path]]
  201. === `path.data`
  202. Every data and master-eligible node requires access to a data directory where
  203. shards and index and cluster metadata will be stored. The `path.data` defaults
  204. to `$ES_HOME/data` but can be configured in the `elasticsearch.yml` config
  205. file an absolute path or a path relative to `$ES_HOME` as follows:
  206. [source,yaml]
  207. -----------------------
  208. path.data: /var/elasticsearch/data
  209. -----------------------
  210. Like all node settings, it can also be specified on the command line as:
  211. [source,sh]
  212. -----------------------
  213. ./bin/elasticsearch -Epath.data=/var/elasticsearch/data
  214. -----------------------
  215. TIP: When using the `.zip` or `.tar.gz` distributions, the `path.data` setting
  216. should be configured to locate the data directory outside the Elasticsearch
  217. home directory, so that the home directory can be deleted without deleting
  218. your data! The RPM and Debian distributions do this for you already.
  219. [float]
  220. == Other node settings
  221. More node settings can be found in <<modules,Modules>>. Of particular note are
  222. the <<cluster.name,`cluster.name`>>, the <<node.name,`node.name`>> and the
  223. <<modules-network,network settings>>.
  224. ifdef::include-xpack[]
  225. include::ml-node.asciidoc[]
  226. endif::include-xpack[]