node.asciidoc 17 KB

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