node.asciidoc 12 KB

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