node.asciidoc 17 KB

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