node-roles.asciidoc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. [[node-roles-overview]]
  2. == Node roles
  3. Any time that you start an instance of {es}, you are starting a _node_. A
  4. collection of connected nodes is called a <<modules-cluster,cluster>>. If you
  5. are running a single node of {es}, then you have a cluster of one node. All nodes know about all the other nodes in the cluster and can forward client
  6. requests to the appropriate node.
  7. Each node performs one or more roles. Roles control the behavior of the node in the cluster.
  8. [discrete]
  9. [[set-node-roles]]
  10. === Set node roles
  11. You define a node's roles by setting `node.roles` in <<settings,`elasticsearch.yml`>>. If you set `node.roles`, the node is only assigned the roles you specify. If you don't set `node.roles`, the node is assigned the following roles:
  12. * `master`
  13. * `data`
  14. * `data_content`
  15. * `data_hot`
  16. * `data_warm`
  17. * `data_cold`
  18. * `data_frozen`
  19. * `ingest`
  20. * `ml`
  21. * `remote_cluster_client`
  22. * `transform`
  23. [IMPORTANT]
  24. ====
  25. If you set `node.roles`, ensure you specify every node role your cluster needs.
  26. Every cluster requires the following node roles:
  27. * `master`
  28. * {blank}
  29. +
  30. --
  31. `data_content` and `data_hot` +
  32. OR +
  33. `data`
  34. --
  35. Some {stack} features also require specific node roles:
  36. - {ccs-cap} and {ccr} require the `remote_cluster_client` role.
  37. - {stack-monitor-app} and ingest pipelines require the `ingest` role.
  38. - {fleet}, the {security-app}, and {transforms} require the `transform` role.
  39. The `remote_cluster_client` role is also required to use {ccs} with these
  40. features.
  41. - {ml-cap} features, such as {anomaly-detect}, require the `ml` role.
  42. ====
  43. As the cluster grows and in particular if you have large {ml} jobs or
  44. {ctransforms}, consider separating dedicated master-eligible nodes from
  45. dedicated data nodes, {ml} nodes, and {transform} nodes.
  46. [discrete]
  47. [[change-node-role]]
  48. === Change the role of a node
  49. Each data node maintains the following data on disk:
  50. * the shard data for every shard allocated to that node,
  51. * the index metadata corresponding with every shard allocated to that node, and
  52. * the cluster-wide metadata, such as settings and index templates.
  53. Similarly, each master-eligible node maintains the following data on disk:
  54. * the index metadata for every index in the cluster, and
  55. * the cluster-wide metadata, such as settings and index templates.
  56. Each node checks the contents of its data path at startup. If it discovers
  57. unexpected data then it will refuse to start. This is to avoid importing
  58. unwanted <<dangling-indices,dangling indices>> which can lead
  59. to a red cluster health. To be more precise, nodes without the `data` role will
  60. refuse to start if they find any shard data on disk at startup, and nodes
  61. without both the `master` and `data` roles will refuse to start if they have any
  62. index metadata on disk at startup.
  63. It is possible to change the roles of a node by adjusting its
  64. `elasticsearch.yml` file and restarting it. This is known as _repurposing_ a
  65. node. In order to satisfy the checks for unexpected data described above, you
  66. must perform some extra steps to prepare a node for repurposing when starting
  67. the node without the `data` or `master` roles.
  68. * If you want to repurpose a data node by removing the `data` role then you
  69. should first use an <<cluster-shard-allocation-filtering,allocation filter>> to safely
  70. migrate all the shard data onto other nodes in the cluster.
  71. * If you want to repurpose a node to have neither the `data` nor `master` roles
  72. then it is simplest to start a brand-new node with an empty data path and the
  73. desired roles. You may find it safest to use an
  74. <<cluster-shard-allocation-filtering,allocation filter>> to migrate the shard data elsewhere
  75. in the cluster first.
  76. If it is not possible to follow these extra steps then you may be able to use
  77. the <<node-tool-repurpose,`elasticsearch-node repurpose`>> tool to delete any
  78. excess data that prevents a node from starting.
  79. [discrete]
  80. [[node-roles-list]]
  81. === Available node roles
  82. The following is a list of the roles that a node can perform in a cluster. A node can have one or more roles.
  83. * <<master-node-role,Master-eligible node>> (`master`): A node that is eligible to be
  84. <<modules-discovery,elected as the _master_ node>>, which controls the cluster.
  85. * <<data-node-role,Data node>> (`data`, `data_content`, `data_hot`, `data_warm`, `data_cold`, `data_frozen`): A node that has one of several data roles. Data nodes hold data and perform data related operations such as CRUD, search, and aggregations. You might use multiple data roles in a cluster so you can implement <<data-tiers,data tiers>>.
  86. * <<node-ingest-node,Ingest node>> (`ingest`): Ingest nodes are able to apply an <<ingest,ingest pipeline>> to a document in order to transform and enrich the document before indexing. With a heavy ingest load, it makes sense to use dedicated ingest nodes and to not include the `ingest` role from nodes that have the `master` or `data` roles.
  87. * <<remote-node,Remote-eligible node>> (`remote_cluster_client`): A node that is eligible to act as a remote client.
  88. * <<ml-node-role,Machine learning node>> (`ml`): A node that can run {ml-features}. If you want to use {ml-features}, there must be at least one {ml} node in your cluster. For more information, see <<ml-settings>> and {ml-docs}/index.html[Machine learning in the {stack}].
  89. * <<transform-node-role,{transform-cap} node>> (`transform`): A node that can perform {transforms}. If you want to use {transforms}, there must be at least one {transform} node in your cluster. For more information, see <<transform-settings>> and <<transforms>>.
  90. [NOTE]
  91. [[coordinating-node]]
  92. .Coordinating node
  93. ===============================================
  94. Requests like search requests or bulk-indexing requests may involve data held
  95. on different data nodes. A search request, for example, is executed in two
  96. phases which are coordinated by the node which receives the client request --
  97. the _coordinating node_.
  98. In the _scatter_ phase, the coordinating node forwards the request to the data
  99. nodes which hold the data. Each data node executes the request locally and
  100. returns its results to the coordinating node. In the _gather_ phase, the
  101. coordinating node reduces each data node's results into a single global
  102. result set.
  103. Every node is implicitly a coordinating node. This means that a node that has
  104. an explicit empty list of roles in the `node.roles` setting will only act as a coordinating
  105. node, which cannot be disabled. As a result, such a node needs to have enough
  106. memory and CPU in order to deal with the gather phase.
  107. ===============================================
  108. [discrete]
  109. [[master-node-role]]
  110. ==== Master-eligible node
  111. The master node is responsible for lightweight cluster-wide actions such as
  112. creating or deleting an index, tracking which nodes are part of the cluster,
  113. and deciding which shards to allocate to which nodes. It is important for
  114. cluster health to have a stable master node.
  115. Any master-eligible node that is not a <<voting-only-node,voting-only node>> may
  116. be elected to become the master node by the <<modules-discovery,master election
  117. process>>.
  118. IMPORTANT: Master nodes must have a `path.data` directory whose contents
  119. persist across restarts, just like data nodes, because this is where the
  120. cluster metadata is stored. The cluster metadata describes how to read the data
  121. stored on the data nodes, so if it is lost then the data stored on the data
  122. nodes cannot be read.
  123. [discrete]
  124. [[dedicated-master-node]]
  125. ===== Dedicated master-eligible node
  126. It is important for the health of the cluster that the elected master node has
  127. the resources it needs to fulfill its responsibilities. If the elected master
  128. node is overloaded with other tasks then the cluster will not operate well. The
  129. most reliable way to avoid overloading the master with other tasks is to
  130. configure all the master-eligible nodes to be _dedicated master-eligible nodes_
  131. which only have the `master` role, allowing them to focus on managing the
  132. cluster. Master-eligible nodes will still also behave as
  133. <<coordinating-node,coordinating nodes>> that route requests from clients to
  134. the other nodes in the cluster, but you should _not_ use dedicated master nodes
  135. for this purpose.
  136. A small or lightly-loaded cluster may operate well if its master-eligible nodes
  137. have other roles and responsibilities, but once your cluster comprises more
  138. than a handful of nodes it usually makes sense to use dedicated master-eligible
  139. nodes.
  140. To create a dedicated master-eligible node, set:
  141. [source,yaml]
  142. -------------------
  143. node.roles: [ master ]
  144. -------------------
  145. [discrete]
  146. [[voting-only-node]]
  147. ===== Voting-only master-eligible node
  148. A voting-only master-eligible node is a node that participates in
  149. <<modules-discovery,master elections>> but which will not act as the cluster's
  150. elected master node. In particular, a voting-only node can serve as a tiebreaker
  151. in elections.
  152. It may seem confusing to use the term "master-eligible" to describe a
  153. voting-only node since such a node is not actually eligible to become the master
  154. at all. This terminology is an unfortunate consequence of history:
  155. master-eligible nodes are those nodes that participate in elections and perform
  156. certain tasks during cluster state publications, and voting-only nodes have the
  157. same responsibilities even if they can never become the elected master.
  158. To configure a master-eligible node as a voting-only node, include `master` and
  159. `voting_only` in the list of roles. For example to create a voting-only data
  160. node:
  161. [source,yaml]
  162. -------------------
  163. node.roles: [ data, master, voting_only ]
  164. -------------------
  165. IMPORTANT: Only nodes with the `master` role can be marked as having the
  166. `voting_only` role.
  167. High availability (HA) clusters require at least three master-eligible nodes, at
  168. least two of which are not voting-only nodes. Such a cluster will be able to
  169. elect a master node even if one of the nodes fails.
  170. Voting-only master-eligible nodes may also fill other roles in your cluster.
  171. For instance, a node may be both a data node and a voting-only master-eligible
  172. node. A _dedicated_ voting-only master-eligible nodes is a voting-only
  173. master-eligible node that fills no other roles in the cluster. To create a
  174. dedicated voting-only master-eligible node, set:
  175. [source,yaml]
  176. -------------------
  177. node.roles: [ master, voting_only ]
  178. -------------------
  179. Since dedicated voting-only nodes never act as the cluster's elected master,
  180. they may require less heap and a less powerful CPU than the true master nodes.
  181. However all master-eligible nodes, including voting-only nodes, are on the
  182. critical path for <<cluster-state-publishing,publishing cluster state
  183. updates>>. Cluster state updates are usually independent of
  184. performance-critical workloads such as indexing or searches, but they are
  185. involved in management activities such as index creation and rollover, mapping
  186. updates, and recovery after a failure. The performance characteristics of these
  187. activities are a function of the speed of the storage on each master-eligible
  188. node, as well as the reliability and latency of the network interconnections
  189. between the elected master node and the other nodes in the cluster. You must
  190. therefore ensure that the storage and networking available to the nodes in your
  191. cluster are good enough to meet your performance goals.
  192. [discrete]
  193. [[data-node-role]]
  194. ==== Data nodes
  195. Data nodes hold the shards that contain the documents you have indexed. Data
  196. nodes handle data related operations like CRUD, search, and aggregations.
  197. These operations are I/O-, memory-, and CPU-intensive. It is important to
  198. monitor these resources and to add more data nodes if they are overloaded.
  199. The main benefit of having dedicated data nodes is the separation of the master
  200. and data roles.
  201. In a multi-tier deployment architecture, you use specialized data roles to
  202. assign data nodes to specific tiers: `data_content`,`data_hot`, `data_warm`,
  203. `data_cold`, or `data_frozen`. A node can belong to multiple tiers.
  204. If you want to include a node in all tiers, or if your cluster does not use multiple tiers, then you can use the generic `data` role.
  205. include::{es-ref-dir}/how-to/shard-limits.asciidoc[]
  206. WARNING: If you assign a node to a specific tier using a specialized data role, then you shouldn't also assign it the generic `data` role. The generic `data` role takes precedence over specialized data roles.
  207. [discrete]
  208. [[generic-data-node]]
  209. ===== Generic data node
  210. Generic data nodes are included in all content tiers. A node with a generic `data` role can fill any of the specialized data node roles.
  211. To create a dedicated generic data node, set:
  212. [source,yaml]
  213. ----
  214. node.roles: [ data ]
  215. ----
  216. [discrete]
  217. [[data-content-node]]
  218. ===== Content data node
  219. Content data nodes are part of the content tier.
  220. include::{es-ref-dir}/datatiers.asciidoc[tag=content-tier]
  221. To create a dedicated content node, set:
  222. [source,yaml]
  223. ----
  224. node.roles: [ data_content ]
  225. ----
  226. [discrete]
  227. [[data-hot-node]]
  228. ===== Hot data node
  229. Hot data nodes are part of the hot tier.
  230. include::{es-ref-dir}/datatiers.asciidoc[tag=hot-tier]
  231. To create a dedicated hot node, set:
  232. [source,yaml]
  233. ----
  234. node.roles: [ data_hot ]
  235. ----
  236. [discrete]
  237. [[data-warm-node]]
  238. ===== Warm data node
  239. Warm data nodes are part of the warm tier.
  240. include::{es-ref-dir}/datatiers.asciidoc[tag=warm-tier]
  241. To create a dedicated warm node, set:
  242. [source,yaml]
  243. ----
  244. node.roles: [ data_warm ]
  245. ----
  246. [discrete]
  247. [[data-cold-node]]
  248. ===== Cold data node
  249. Cold data nodes are part of the cold tier.
  250. include::{es-ref-dir}/datatiers.asciidoc[tag=cold-tier]
  251. To create a dedicated cold node, set:
  252. [source,yaml]
  253. ----
  254. node.roles: [ data_cold ]
  255. ----
  256. [discrete]
  257. [[data-frozen-node]]
  258. ===== Frozen data node
  259. Frozen data nodes are part of the frozen tier.
  260. include::{es-ref-dir}/datatiers.asciidoc[tag=frozen-tier]
  261. To create a dedicated frozen node, set:
  262. [source,yaml]
  263. ----
  264. node.roles: [ data_frozen ]
  265. ----
  266. [discrete]
  267. [[node-ingest-node]]
  268. ==== Ingest node
  269. Ingest nodes can execute pre-processing pipelines, composed of one or more
  270. ingest processors. Depending on the type of operations performed by the ingest
  271. processors and the required resources, it may make sense to have dedicated
  272. ingest nodes, that will only perform this specific task.
  273. To create a dedicated ingest node, set:
  274. [source,yaml]
  275. ----
  276. node.roles: [ ingest ]
  277. ----
  278. [discrete]
  279. [[coordinating-only-node-role]]
  280. ==== Coordinating only node
  281. If you take away the ability to be able to handle master duties, to hold data,
  282. and pre-process documents, then you are left with a _coordinating_ node that
  283. can only route requests, handle the search reduce phase, and distribute bulk
  284. indexing. Essentially, coordinating only nodes behave as smart load balancers.
  285. Coordinating only nodes can benefit large clusters by offloading the
  286. coordinating node role from data and master-eligible nodes. They join the
  287. cluster and receive the full <<cluster-state,cluster state>>, like every other
  288. node, and they use the cluster state to route requests directly to the
  289. appropriate place(s).
  290. WARNING: Adding too many coordinating only nodes to a cluster can increase the
  291. burden on the entire cluster because the elected master node must await
  292. acknowledgement of cluster state updates from every node! The benefit of
  293. coordinating only nodes should not be overstated -- data nodes can happily
  294. serve the same purpose.
  295. To create a dedicated coordinating node, set:
  296. [source,yaml]
  297. ----
  298. node.roles: [ ]
  299. ----
  300. [discrete]
  301. [[remote-node]]
  302. ==== Remote-eligible node
  303. A remote-eligible node acts as a cross-cluster client and connects to
  304. <<remote-clusters,remote clusters>>. Once connected, you can search
  305. remote clusters using <<modules-cross-cluster-search,{ccs}>>. You can also sync
  306. data between clusters using <<xpack-ccr,{ccr}>>.
  307. [source,yaml]
  308. ----
  309. node.roles: [ remote_cluster_client ]
  310. ----
  311. [discrete]
  312. [[ml-node-role]]
  313. ==== [xpack]#Machine learning node#
  314. {ml-cap} nodes run jobs and handle {ml} API requests. For more information, see
  315. <<ml-settings>>.
  316. To create a dedicated {ml} node, set:
  317. [source,yaml]
  318. ----
  319. node.roles: [ ml, remote_cluster_client]
  320. ----
  321. The `remote_cluster_client` role is optional but strongly recommended.
  322. Otherwise, {ccs} fails when used in {ml} jobs or {dfeeds}. If you use {ccs} in
  323. your {anomaly-jobs}, the `remote_cluster_client` role is also required on all
  324. master-eligible nodes. Otherwise, the {dfeed} cannot start. See <<remote-node>>.
  325. [discrete]
  326. [[transform-node-role]]
  327. ==== [xpack]#{transform-cap} node#
  328. {transform-cap} nodes run {transforms} and handle {transform} API requests. For
  329. more information, see <<transform-settings>>.
  330. To create a dedicated {transform} node, set:
  331. [source,yaml]
  332. ----
  333. node.roles: [ transform, remote_cluster_client ]
  334. ----
  335. The `remote_cluster_client` role is optional but strongly recommended.
  336. Otherwise, {ccs} fails when used in {transforms}. See <<remote-node>>.