node.asciidoc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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 that is not a <<voting-only-node,voting-only node>> may
  67. be elected to become the master node by the <<modules-discovery,master election
  68. process>>.
  69. IMPORTANT: Master nodes must have access to the `data/` directory (just like
  70. `data` nodes) as this is where the cluster state is persisted between node restarts.
  71. Indexing and searching your data is CPU-, memory-, and I/O-intensive work
  72. which can put pressure on a node's resources. To ensure that your master
  73. node is stable and not under pressure, it is a good idea in a bigger
  74. cluster to split the roles between dedicated master-eligible nodes and
  75. dedicated data nodes.
  76. While master nodes can also behave as <<coordinating-node,coordinating nodes>>
  77. and route search and indexing requests from clients to data nodes, it is
  78. better _not_ to use dedicated master nodes for this purpose. It is important
  79. for the stability of the cluster that master-eligible nodes do as little work
  80. as possible.
  81. To create a dedicated master-eligible node in the {default-dist}, set:
  82. [source,yaml]
  83. -------------------
  84. node.master: true <1>
  85. node.data: false <2>
  86. node.ingest: false <3>
  87. node.ml: false <4>
  88. xpack.ml.enabled: true <5>
  89. cluster.remote.connect: false <6>
  90. -------------------
  91. <1> The `node.master` role is enabled by default.
  92. <2> Disable the `node.data` role (enabled by default).
  93. <3> Disable the `node.ingest` role (enabled by default).
  94. <4> Disable the `node.ml` role (enabled by default).
  95. <5> The `xpack.ml.enabled` setting is enabled by default.
  96. <6> Disable {ccs} (enabled by default).
  97. To create a dedicated master-eligible node in the {oss-dist}, set:
  98. [source,yaml]
  99. -------------------
  100. node.master: true <1>
  101. node.data: false <2>
  102. node.ingest: false <3>
  103. cluster.remote.connect: false <4>
  104. -------------------
  105. <1> The `node.master` role is enabled by default.
  106. <2> Disable the `node.data` role (enabled by default).
  107. <3> Disable the `node.ingest` role (enabled by default).
  108. <4> Disable {ccs} (enabled by default).
  109. [float]
  110. [[voting-only-node]]
  111. ==== Voting-only master-eligible node
  112. A voting-only master-eligible node is a node that participates in
  113. <<modules-discovery,master elections>> but which will not act as the cluster's
  114. elected master node. In particular, a voting-only node can serve as a tiebreaker
  115. in elections.
  116. It may seem confusing to use the term "master-eligible" to describe a
  117. voting-only node since such a node is not actually eligible to become the master
  118. at all. This terminology is an unfortunate consequence of history:
  119. master-eligible nodes are those nodes that participate in elections and perform
  120. certain tasks during cluster state publications, and voting-only nodes have the
  121. same responsibilities even if they can never become the elected master.
  122. To configure a master-eligible node as a voting-only node, set the following
  123. setting:
  124. [source,yaml]
  125. -------------------
  126. node.voting_only: true <1>
  127. -------------------
  128. <1> The default for `node.voting_only` is `false`.
  129. IMPORTANT: The `voting_only` role requires the {default-dist} of Elasticsearch
  130. and is not supported in the {oss-dist}. If you use the {oss-dist} and set
  131. `node.voting_only` then the node will fail to start. Also note that only
  132. master-eligible nodes can be marked as voting-only.
  133. High availability (HA) clusters require at least three master-eligible nodes, at
  134. least two of which are not voting-only nodes. Such a cluster will be able to
  135. elect a master node even if one of the nodes fails.
  136. Since voting-only nodes never act as the cluster's elected master, they may
  137. require require less heap and a less powerful CPU than the true master nodes.
  138. However all master-eligible nodes, including voting-only nodes, require
  139. reasonably fast persistent storage and a reliable and low-latency network
  140. connection to the rest of the cluster, since they are on the critical path for
  141. <<cluster-state-publishing,publishing cluster state updates>>.
  142. [float]
  143. [[data-node]]
  144. === Data Node
  145. Data nodes hold the shards that contain the documents you have indexed. Data
  146. nodes handle data related operations like CRUD, search, and aggregations.
  147. These operations are I/O-, memory-, and CPU-intensive. It is important to
  148. monitor these resources and to add more data nodes if they are overloaded.
  149. The main benefit of having dedicated data nodes is the separation of the
  150. master and data roles.
  151. To create a dedicated data node in the {default-dist}, set:
  152. [source,yaml]
  153. -------------------
  154. node.master: false <1>
  155. node.data: true <2>
  156. node.ingest: false <3>
  157. node.ml: false <4>
  158. cluster.remote.connect: false <5>
  159. -------------------
  160. <1> Disable the `node.master` role (enabled by default).
  161. <2> The `node.data` role is enabled by default.
  162. <3> Disable the `node.ingest` role (enabled by default).
  163. <4> Disable the `node.ml` role (enabled by default).
  164. <5> Disable {ccs} (enabled by default).
  165. To create a dedicated data node in the {oss-dist}, set:
  166. [source,yaml]
  167. -------------------
  168. node.master: false <1>
  169. node.data: true <2>
  170. node.ingest: false <3>
  171. cluster.remote.connect: false <4>
  172. -------------------
  173. <1> Disable the `node.master` role (enabled by default).
  174. <2> The `node.data` role is enabled by default.
  175. <3> Disable the `node.ingest` role (enabled by default).
  176. <4> Disable {ccs} (enabled by default).
  177. [float]
  178. [[node-ingest-node]]
  179. === Ingest Node
  180. Ingest nodes can execute pre-processing pipelines, composed of one or more
  181. ingest processors. Depending on the type of operations performed by the ingest
  182. processors and the required resources, it may make sense to have dedicated
  183. ingest nodes, that will only perform this specific task.
  184. To create a dedicated ingest node in the {default-dist}, set:
  185. [source,yaml]
  186. -------------------
  187. node.master: false <1>
  188. node.data: false <2>
  189. node.ingest: true <3>
  190. node.ml: false <4>
  191. cluster.remote.connect: false <5>
  192. -------------------
  193. <1> Disable the `node.master` role (enabled by default).
  194. <2> Disable the `node.data` role (enabled by default).
  195. <3> The `node.ingest` role is enabled by default.
  196. <4> Disable the `node.ml` role (enabled by default).
  197. <5> Disable {ccs} (enabled by default).
  198. To create a dedicated ingest node in the {oss-dist}, set:
  199. [source,yaml]
  200. -------------------
  201. node.master: false <1>
  202. node.data: false <2>
  203. node.ingest: true <3>
  204. cluster.remote.connect: false <4>
  205. -------------------
  206. <1> Disable the `node.master` role (enabled by default).
  207. <2> Disable the `node.data` role (enabled by default).
  208. <3> The `node.ingest` role is enabled by default.
  209. <4> Disable {ccs} (enabled by default).
  210. [float]
  211. [[coordinating-only-node]]
  212. === Coordinating only node
  213. If you take away the ability to be able to handle master duties, to hold data,
  214. and pre-process documents, then you are left with a _coordinating_ node that
  215. can only route requests, handle the search reduce phase, and distribute bulk
  216. indexing. Essentially, coordinating only nodes behave as smart load balancers.
  217. Coordinating only nodes can benefit large clusters by offloading the
  218. coordinating node role from data and master-eligible nodes. They join the
  219. cluster and receive the full <<cluster-state,cluster state>>, like every other
  220. node, and they use the cluster state to route requests directly to the
  221. appropriate place(s).
  222. WARNING: Adding too many coordinating only nodes to a cluster can increase the
  223. burden on the entire cluster because the elected master node must await
  224. acknowledgement of cluster state updates from every node! The benefit of
  225. coordinating only nodes should not be overstated -- data nodes can happily
  226. serve the same purpose.
  227. To create a dedicated coordinating node in the {default-dist}, set:
  228. [source,yaml]
  229. -------------------
  230. node.master: false <1>
  231. node.data: false <2>
  232. node.ingest: false <3>
  233. node.ml: false <4>
  234. cluster.remote.connect: false <5>
  235. -------------------
  236. <1> Disable the `node.master` role (enabled by default).
  237. <2> Disable the `node.data` role (enabled by default).
  238. <3> Disable the `node.ingest` role (enabled by default).
  239. <4> Disable the `node.ml` role (enabled by default).
  240. <5> Disable {ccs} (enabled by default).
  241. To create a dedicated coordinating node in the {oss-dist}, set:
  242. [source,yaml]
  243. -------------------
  244. node.master: false <1>
  245. node.data: false <2>
  246. node.ingest: false <3>
  247. cluster.remote.connect: false <4>
  248. -------------------
  249. <1> Disable the `node.master` role (enabled by default).
  250. <2> Disable the `node.data` role (enabled by default).
  251. <3> Disable the `node.ingest` role (enabled by default).
  252. <4> Disable {ccs} (enabled by default).
  253. [float]
  254. [[ml-node]]
  255. === [xpack]#Machine learning node#
  256. The {ml-features} provide {ml} nodes, which run jobs and handle {ml} API
  257. requests. If `xpack.ml.enabled` is set to true and `node.ml` is set to `false`,
  258. the node can service API requests but it cannot run jobs.
  259. If you want to use {ml-features} in your cluster, you must enable {ml}
  260. (set `xpack.ml.enabled` to `true`) on all master-eligible nodes. If you have the
  261. {oss-dist}, do not use these settings.
  262. For more information about these settings, see <<ml-settings>>.
  263. To create a dedicated {ml} node in the {default-dist}, set:
  264. [source,yaml]
  265. -------------------
  266. node.master: false <1>
  267. node.data: false <2>
  268. node.ingest: false <3>
  269. node.ml: true <4>
  270. xpack.ml.enabled: true <5>
  271. cluster.remote.connect: false <6>
  272. -------------------
  273. <1> Disable the `node.master` role (enabled by default).
  274. <2> Disable the `node.data` role (enabled by default).
  275. <3> Disable the `node.ingest` role (enabled by default).
  276. <4> The `node.ml` role is enabled by default.
  277. <5> The `xpack.ml.enabled` setting is enabled by default.
  278. <6> Disable {ccs} (enabled by default).
  279. [float]
  280. [[change-node-role]]
  281. === Changing the role of a node
  282. Each data node maintains the following data on disk:
  283. * the shard data for every shard allocated to that node,
  284. * the index metadata corresponding with every shard allocated to that node, and
  285. * the cluster-wide metadata, such as settings and index templates.
  286. Similarly, each master-eligible node maintains the following data on disk:
  287. * the index metadata for every index in the cluster, and
  288. * the cluster-wide metadata, such as settings and index templates.
  289. Each node checks the contents of its data path at startup. If it discovers
  290. unexpected data then it will refuse to start. This is to avoid importing
  291. unwanted <<modules-gateway-dangling-indices,dangling indices>> which can lead
  292. to a red cluster health. To be more precise, nodes with `node.data: false` will
  293. refuse to start if they find any shard data on disk at startup, and nodes with
  294. both `node.master: false` and `node.data: false` will refuse to start if they
  295. have any index metadata on disk at startup.
  296. It is possible to change the roles of a node by adjusting its
  297. `elasticsearch.yml` file and restarting it. This is known as _repurposing_ a
  298. node. In order to satisfy the checks for unexpected data described above, you
  299. must perform some extra steps to prepare a node for repurposing when setting
  300. its `node.data` or `node.master` roles to `false`:
  301. * If you want to repurpose a data node by changing `node.data` to `false` then
  302. you should first use an <<allocation-filtering,allocation filter>> to safely
  303. migrate all the shard data onto other nodes in the cluster.
  304. * If you want to repurpose a node to have both `node.master: false` and
  305. `node.data: false` then it is simplest to start a brand-new node with an
  306. empty data path and the desired roles. You may find it safest to use an
  307. <<allocation-filtering,allocation filter>> to migrate the shard data
  308. elsewhere in the cluster first.
  309. If it is not possible to follow these extra steps then you may be able to use
  310. the <<node-tool-repurpose,`elasticsearch-node repurpose`>> tool to delete any
  311. excess data that prevents a node from starting.
  312. [float]
  313. == Node data path settings
  314. [float]
  315. [[data-path]]
  316. === `path.data`
  317. Every data and master-eligible node requires access to a data directory where
  318. shards and index and cluster metadata will be stored. The `path.data` defaults
  319. to `$ES_HOME/data` but can be configured in the `elasticsearch.yml` config
  320. file an absolute path or a path relative to `$ES_HOME` as follows:
  321. [source,yaml]
  322. -----------------------
  323. path.data: /var/elasticsearch/data
  324. -----------------------
  325. Like all node settings, it can also be specified on the command line as:
  326. [source,sh]
  327. -----------------------
  328. ./bin/elasticsearch -Epath.data=/var/elasticsearch/data
  329. -----------------------
  330. TIP: When using the `.zip` or `.tar.gz` distributions, the `path.data` setting
  331. should be configured to locate the data directory outside the Elasticsearch
  332. home directory, so that the home directory can be deleted without deleting
  333. your data! The RPM and Debian distributions do this for you already.
  334. [float]
  335. == Other node settings
  336. More node settings can be found in <<modules,Modules>>. Of particular note are
  337. the <<cluster.name,`cluster.name`>>, the <<node.name,`node.name`>> and the
  338. <<modules-network,network settings>>.