node.asciidoc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. [[modules-node]]
  2. === Node
  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.
  6. Every node in the cluster can handle <<modules-http,HTTP>> and
  7. <<modules-transport,Transport>> traffic by default. The transport layer is used
  8. exclusively for communication between nodes; the HTTP layer is used by REST
  9. clients.
  10. [[modules-node-description]]
  11. // tag::modules-node-description-tag[]
  12. All nodes know about all the other nodes in the cluster and can forward client
  13. requests to the appropriate node.
  14. // end::modules-node-description-tag[]
  15. [[node-roles]]
  16. ==== Node roles
  17. You can define the roles of a node by setting `node.roles`. If you don't
  18. configure this setting, the node has the following roles by default:
  19. * `master`
  20. * `data`
  21. * `data_content`
  22. * `data_hot`
  23. * `data_warm`
  24. * `data_cold`
  25. * `ingest`
  26. * `ml`
  27. * `remote_cluster_client`
  28. * `transform`
  29. NOTE: If you set `node.roles`, the node is assigned only the roles you specify.
  30. As the cluster grows and in particular if you have large {ml} jobs or
  31. {ctransforms}, consider separating dedicated master-eligible nodes from
  32. dedicated data nodes, {ml} nodes, and {transform} nodes.
  33. <<master-node,Master-eligible node>>::
  34. A node that has the `master` role (default), which makes it eligible to be
  35. <<modules-discovery,elected as the _master_ node>>, which controls the cluster.
  36. <<data-node,Data node>>::
  37. A node that has the `data` role (default). Data nodes hold data and perform data
  38. related operations such as CRUD, search, and aggregations. A node with the `data` role can fill any of the specialised data node roles.
  39. <<node-ingest-node,Ingest node>>::
  40. A node that has the `ingest` role (default). Ingest nodes are able to apply an
  41. <<pipeline,ingest pipeline>> to a document in order to transform and enrich the
  42. document before indexing. With a heavy ingest load, it makes sense to use
  43. dedicated ingest nodes and to not include the `ingest` role from nodes that have
  44. the `master` or `data` roles.
  45. <<remote-node,Remote-eligible node>>::
  46. A node that has the `remote_cluster_client` role (default), which makes it
  47. eligible to act as a remote client. By default, any node in the cluster can act
  48. as a cross-cluster client and connect to remote clusters.
  49. <<ml-node,Machine learning node>>::
  50. A node that has `xpack.ml.enabled` and the `ml` role, which is the default
  51. behavior in the {es} {default-dist}. If you want to use {ml-features}, there
  52. must be at least one {ml} node in your cluster. For more information about
  53. {ml-features}, see {ml-docs}/index.html[Machine learning in the {stack}].
  54. <<transform-node,{transform-cap} node>>::
  55. A node that has the `transform` role. If you want to use {transforms}, there
  56. be at least one {transform} node in your cluster. For more information, see
  57. <<transform-settings>> and <<transforms>>.
  58. [NOTE]
  59. [[coordinating-node]]
  60. .Coordinating node
  61. ===============================================
  62. Requests like search requests or bulk-indexing requests may involve data held
  63. on different data nodes. A search request, for example, is executed in two
  64. phases which are coordinated by the node which receives the client request --
  65. the _coordinating node_.
  66. In the _scatter_ phase, the coordinating node forwards the request to the data
  67. nodes which hold the data. Each data node executes the request locally and
  68. returns its results to the coordinating node. In the _gather_ phase, the
  69. coordinating node reduces each data node's results into a single global
  70. result set.
  71. Every node is implicitly a coordinating node. This means that a node that has
  72. an explicit empty list of roles via `node.roles` will only act as a coordinating
  73. node, which cannot be disabled. As a result, such a node needs to have enough
  74. memory and CPU in order to deal with the gather phase.
  75. ===============================================
  76. [[master-node]]
  77. ==== Master-eligible node
  78. The master node is responsible for lightweight cluster-wide actions such as
  79. creating or deleting an index, tracking which nodes are part of the cluster,
  80. and deciding which shards to allocate to which nodes. It is important for
  81. cluster health to have a stable master node.
  82. Any master-eligible node that is not a <<voting-only-node,voting-only node>> may
  83. be elected to become the master node by the <<modules-discovery,master election
  84. process>>.
  85. IMPORTANT: Master nodes must have access to the `data/` directory (just like
  86. `data` nodes) as this is where the cluster state is persisted between node
  87. restarts.
  88. [[dedicated-master-node]]
  89. ===== Dedicated master-eligible node
  90. It is important for the health of the cluster that the elected master node has
  91. the resources it needs to fulfill its responsibilities. If the elected master
  92. node is overloaded with other tasks then the cluster may not operate well. In
  93. particular, indexing and searching your data can be very resource-intensive, so
  94. in large or high-throughput clusters it is a good idea to avoid using the
  95. master-eligible nodes for tasks such as indexing and searching. You can do this
  96. by configuring three of your nodes to be dedicated master-eligible nodes.
  97. Dedicated master-eligible nodes only have the `master` role, allowing them to
  98. focus on managing the cluster. While master nodes can also behave as
  99. <<coordinating-node,coordinating nodes>> and route search and indexing requests
  100. from clients to data nodes, it is better _not_ to use dedicated master nodes for
  101. this purpose.
  102. To create a dedicated master-eligible node, set:
  103. [source,yaml]
  104. -------------------
  105. node.roles: [ master ]
  106. -------------------
  107. [[voting-only-node]]
  108. ===== Voting-only master-eligible node
  109. A voting-only master-eligible node is a node that participates in
  110. <<modules-discovery,master elections>> but which will not act as the cluster's
  111. elected master node. In particular, a voting-only node can serve as a tiebreaker
  112. in elections.
  113. It may seem confusing to use the term "master-eligible" to describe a
  114. voting-only node since such a node is not actually eligible to become the master
  115. at all. This terminology is an unfortunate consequence of history:
  116. master-eligible nodes are those nodes that participate in elections and perform
  117. certain tasks during cluster state publications, and voting-only nodes have the
  118. same responsibilities even if they can never become the elected master.
  119. To configure a master-eligible node as a voting-only node, include `master` and
  120. `voting_only` in the list of roles. For example to create a voting-only data
  121. node:
  122. [source,yaml]
  123. -------------------
  124. node.roles: [ data, master, voting_only ]
  125. -------------------
  126. IMPORTANT: The `voting_only` role requires the {default-dist} of {es} and is not
  127. supported in the {oss-dist}. If you use the {oss-dist} and add the `voting_only`
  128. role then the node will fail to start. Also note that only nodes with the
  129. `master` role can be marked as having the `voting_only` role.
  130. High availability (HA) clusters require at least three master-eligible nodes, at
  131. least two of which are not voting-only nodes. Such a cluster will be able to
  132. elect a master node even if one of the nodes fails.
  133. Since voting-only nodes never act as the cluster's elected master, they may
  134. require less heap and a less powerful CPU than the true master nodes.
  135. However all master-eligible nodes, including voting-only nodes, require
  136. reasonably fast persistent storage and a reliable and low-latency network
  137. connection to the rest of the cluster, since they are on the critical path for
  138. <<cluster-state-publishing,publishing cluster state updates>>.
  139. Voting-only master-eligible nodes may also fill other roles in your cluster.
  140. For instance, a node may be both a data node and a voting-only master-eligible
  141. node. A _dedicated_ voting-only master-eligible nodes is a voting-only
  142. master-eligible node that fills no other roles in the cluster. To create a
  143. dedicated voting-only master-eligible node in the {default-dist}, set:
  144. [source,yaml]
  145. -------------------
  146. node.roles: [ master, voting_only ]
  147. -------------------
  148. [[data-node]]
  149. ==== Data node
  150. Data nodes hold the shards that contain the documents you have indexed. Data
  151. nodes handle data related operations like CRUD, search, and aggregations.
  152. These operations are I/O-, memory-, and CPU-intensive. It is important to
  153. monitor these resources and to add more data nodes if they are overloaded.
  154. The main benefit of having dedicated data nodes is the separation of the master
  155. and data roles.
  156. To create a dedicated data node, set:
  157. [source,yaml]
  158. ----
  159. node.roles: [ data ]
  160. ----
  161. In a multi-tier deployment architecture, you use specialised data roles to assign data nodes to specific tiers: `data_content`,`data_hot`,
  162. `data_warm`, or `data_cold`. A node can belong to multiple tiers, but a node that has one of the specialised data roles cannot have the
  163. generic `data` role.
  164. [[data-content-node]]
  165. ==== [x-pack]#Content data node#
  166. Content data nodes accommodate user-created content. They enable operations like CRUD,
  167. search and aggregations.
  168. To create a dedicated content node, set:
  169. [source,yaml]
  170. ----
  171. node.roles: [ data_content ]
  172. ----
  173. [[data-hot-node]]
  174. ==== [x-pack]#Hot data node#
  175. Hot data nodes store time series data as it enters {es}. The hot tier must be fast for
  176. both reads and writes, and requires more hardware resources (such as SSD drives).
  177. To create a dedicated hot node, set:
  178. [source,yaml]
  179. ----
  180. node.roles: [ data_hot ]
  181. ----
  182. [[data-warm-node]]
  183. ==== [x-pack]#Warm data node#
  184. Warm data nodes store indices that are no longer being regularly updated, but are still being
  185. queried. Query volume is usually at a lower frequency than it was while the index was in the hot tier.
  186. Less performant hardware can usually be used for nodes in this tier.
  187. To create a dedicated warm node, set:
  188. [source,yaml]
  189. ----
  190. node.roles: [ data_warm ]
  191. ----
  192. [[data-cold-node]]
  193. ==== [x-pack]#Cold data node#
  194. Cold data nodes store read-only indices that are accessed less frequently. This tier uses less performant hardware and may leverage searchable snapshot indices to minimize the resources required.
  195. To create a dedicated cold node, set:
  196. [source,yaml]
  197. ----
  198. node.roles: [ data_cold ]
  199. ----
  200. [[node-ingest-node]]
  201. ==== Ingest node
  202. Ingest nodes can execute pre-processing pipelines, composed of one or more
  203. ingest processors. Depending on the type of operations performed by the ingest
  204. processors and the required resources, it may make sense to have dedicated
  205. ingest nodes, that will only perform this specific task.
  206. To create a dedicated ingest node, set:
  207. [source,yaml]
  208. ----
  209. node.roles: [ ingest ]
  210. ----
  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, set:
  228. [source,yaml]
  229. ----
  230. node.roles: [ ]
  231. ----
  232. [[remote-node]]
  233. ==== Remote-eligible node
  234. By default, any node in a cluster can act as a cross-cluster client and connect
  235. to <<modules-remote-clusters,remote clusters>>. Once connected, you can search
  236. remote clusters using <<modules-cross-cluster-search,{ccs}>>. You can also sync
  237. data between clusters using <<xpack-ccr,{ccr}>>.
  238. [source,yaml]
  239. ----
  240. node.roles: [ remote_cluster_client ]
  241. ----
  242. [[ml-node]]
  243. ==== [xpack]#Machine learning node#
  244. The {ml-features} provide {ml} nodes, which run jobs and handle {ml} API
  245. requests. If `xpack.ml.enabled` is set to `true` and the node does not have the
  246. `ml` role, the node can service API requests but it cannot run jobs.
  247. If you want to use {ml-features} in your cluster, you must enable {ml}
  248. (set `xpack.ml.enabled` to `true`) on all master-eligible nodes. If you want to
  249. use {ml-features} in clients (including {kib}), it must also be enabled on all
  250. coordinating nodes.
  251. For more information about these settings, see <<ml-settings>>.
  252. To create a dedicated {ml} node in the {default-dist}, set:
  253. [source,yaml]
  254. ----
  255. node.roles: [ ml, remote_cluster_client] <1>
  256. xpack.ml.enabled: true <2>
  257. ----
  258. <1> The `remote_cluster_client` role is optional but strongly recommended.
  259. Otherwise, {ccs} fails when used in {ml} jobs or {dfeeds}. See <<remote-node>>.
  260. <2> The `xpack.ml.enabled` setting is enabled by default.
  261. [[transform-node]]
  262. ==== [xpack]#{transform-cap} node#
  263. {transform-cap} nodes run {transforms} and handle {transform} API requests. For
  264. more information, see <<transform-settings>>.
  265. To create a dedicated {transform} node in the {default-dist}, set:
  266. [source,yaml]
  267. ----
  268. node.roles: [ transform, remote_cluster_client ] <1>
  269. ----
  270. <1> The `remote_cluster_client` role is optional but strongly recommended.
  271. Otherwise, {ccs} fails when used in {transforms}. See <<remote-node>>.
  272. [[change-node-role]]
  273. ==== Changing the role of a node
  274. Each data node maintains the following data on disk:
  275. * the shard data for every shard allocated to that node,
  276. * the index metadata corresponding with every shard allocated to that node, and
  277. * the cluster-wide metadata, such as settings and index templates.
  278. Similarly, each master-eligible node maintains the following data on disk:
  279. * the index metadata for every index in the cluster, and
  280. * the cluster-wide metadata, such as settings and index templates.
  281. Each node checks the contents of its data path at startup. If it discovers
  282. unexpected data then it will refuse to start. This is to avoid importing
  283. unwanted <<modules-gateway-dangling-indices,dangling indices>> which can lead
  284. to a red cluster health. To be more precise, nodes without the `data` role will
  285. refuse to start if they find any shard data on disk at startup, and nodes
  286. without both the `master` and `data` roles will refuse to start if they have any
  287. index metadata on disk at startup.
  288. It is possible to change the roles of a node by adjusting its
  289. `elasticsearch.yml` file and restarting it. This is known as _repurposing_ a
  290. node. In order to satisfy the checks for unexpected data described above, you
  291. must perform some extra steps to prepare a node for repurposing when starting
  292. the node without the `data` or `master` roles.
  293. * If you want to repurpose a data node by removing the `data` role then you
  294. should first use an <<allocation-filtering,allocation filter>> to safely
  295. migrate all the shard data onto other nodes in the cluster.
  296. * If you want to repurpose a node to have neither the `data` nor `master` roles
  297. then it is simplest to start a brand-new node with an empty data path and the
  298. desired roles. You may find it safest to use an
  299. <<allocation-filtering,allocation filter>> to migrate the shard data elsewhere
  300. in the cluster first.
  301. If it is not possible to follow these extra steps then you may be able to use
  302. the <<node-tool-repurpose,`elasticsearch-node repurpose`>> tool to delete any
  303. excess data that prevents a node from starting.
  304. [discrete]
  305. === Node data path settings
  306. [[data-path]]
  307. ==== `path.data`
  308. Every data and master-eligible node requires access to a data directory where
  309. shards and index and cluster metadata will be stored. The `path.data` defaults
  310. to `$ES_HOME/data` but can be configured in the `elasticsearch.yml` config
  311. file an absolute path or a path relative to `$ES_HOME` as follows:
  312. [source,yaml]
  313. ----
  314. path.data: /var/elasticsearch/data
  315. ----
  316. Like all node settings, it can also be specified on the command line as:
  317. [source,sh]
  318. ----
  319. ./bin/elasticsearch -Epath.data=/var/elasticsearch/data
  320. ----
  321. TIP: When using the `.zip` or `.tar.gz` distributions, the `path.data` setting
  322. should be configured to locate the data directory outside the {es} home
  323. directory, so that the home directory can be deleted without deleting your data!
  324. The RPM and Debian distributions do this for you already.
  325. [discrete]
  326. [[other-node-settings]]
  327. === Other node settings
  328. More node settings can be found in <<settings>> and <<important-settings>>,
  329. including:
  330. * <<cluster-name,`cluster.name`>>
  331. * <<node-name,`node.name`>>
  332. * <<modules-network,network settings>>