node.asciidoc 14 KB

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