node.asciidoc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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. +
  55. IMPORTANT: If you use the {oss-dist}, do not add the `ml` role. Otherwise, the
  56. node fails to start.
  57. <<transform-node,{transform-cap} node>>::
  58. A node that has the `transform` role. If you want to use {transforms}, there
  59. be at least one {transform} node in your cluster. For more information, see
  60. <<transform-settings>> and <<transforms>>.
  61. [NOTE]
  62. [[coordinating-node]]
  63. .Coordinating node
  64. ===============================================
  65. Requests like search requests or bulk-indexing requests may involve data held
  66. on different data nodes. A search request, for example, is executed in two
  67. phases which are coordinated by the node which receives the client request --
  68. the _coordinating node_.
  69. In the _scatter_ phase, the coordinating node forwards the request to the data
  70. nodes which hold the data. Each data node executes the request locally and
  71. returns its results to the coordinating node. In the _gather_ phase, the
  72. coordinating node reduces each data node's results into a single global
  73. result set.
  74. Every node is implicitly a coordinating node. This means that a node that has
  75. an explicit empty list of roles via `node.roles` will only act as a coordinating
  76. node, which cannot be disabled. As a result, such a node needs to have enough
  77. memory and CPU in order to deal with the gather phase.
  78. ===============================================
  79. [[master-node]]
  80. ==== Master-eligible node
  81. The master node is responsible for lightweight cluster-wide actions such as
  82. creating or deleting an index, tracking which nodes are part of the cluster,
  83. and deciding which shards to allocate to which nodes. It is important for
  84. cluster health to have a stable master node.
  85. Any master-eligible node that is not a <<voting-only-node,voting-only node>> may
  86. be elected to become the master node by the <<modules-discovery,master election
  87. process>>.
  88. IMPORTANT: Master nodes must have access to the `data/` directory (just like
  89. `data` nodes) as this is where the cluster state is persisted between node
  90. restarts.
  91. [[dedicated-master-node]]
  92. ===== Dedicated master-eligible node
  93. It is important for the health of the cluster that the elected master node has
  94. the resources it needs to fulfill its responsibilities. If the elected master
  95. node is overloaded with other tasks then the cluster may not operate well. In
  96. particular, indexing and searching your data can be very resource-intensive, so
  97. in large or high-throughput clusters it is a good idea to avoid using the
  98. master-eligible nodes for tasks such as indexing and searching. You can do this
  99. by configuring three of your nodes to be dedicated master-eligible nodes.
  100. Dedicated master-eligible nodes only have the `master` role, allowing them to
  101. focus on managing the cluster. While master nodes can also behave as
  102. <<coordinating-node,coordinating nodes>> and route search and indexing requests
  103. from clients to data nodes, it is better _not_ to use dedicated master nodes for
  104. this purpose.
  105. To create a dedicated master-eligible node, set:
  106. [source,yaml]
  107. -------------------
  108. node.roles: [ master ]
  109. -------------------
  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, include `master` and
  123. `voting_only` in the list of roles. For example to create a voting-only data
  124. node:
  125. [source,yaml]
  126. -------------------
  127. node.roles: [ data, master, voting_only ]
  128. -------------------
  129. IMPORTANT: The `voting_only` role requires the {default-dist} of {es} and is not
  130. supported in the {oss-dist}. If you use the {oss-dist} and add the `voting_only`
  131. role then the node will fail to start. Also note that only nodes with the
  132. `master` role can be marked as having the `voting_only` role.
  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 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. Voting-only master-eligible nodes may also fill other roles in your cluster.
  143. For instance, a node may be both a data node and a voting-only master-eligible
  144. node. A _dedicated_ voting-only master-eligible nodes is a voting-only
  145. master-eligible node that fills no other roles in the cluster. To create a
  146. dedicated voting-only master-eligible node in the {default-dist}, set:
  147. [source,yaml]
  148. -------------------
  149. node.roles: [ master, voting_only ]
  150. -------------------
  151. [[data-node]]
  152. ==== Data node
  153. Data nodes hold the shards that contain the documents you have indexed. Data
  154. nodes handle data related operations like CRUD, search, and aggregations.
  155. These operations are I/O-, memory-, and CPU-intensive. It is important to
  156. monitor these resources and to add more data nodes if they are overloaded.
  157. The main benefit of having dedicated data nodes is the separation of the master
  158. and data roles.
  159. To create a dedicated data node, set:
  160. [source,yaml]
  161. ----
  162. node.roles: [ data ]
  163. ----
  164. In a multi-tier deployment architecture, you use specialised data roles to assign data nodes to specific tiers: `data_content`,`data_hot`,
  165. `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
  166. generic `data` role.
  167. [[data-content-node]]
  168. ==== [x-pack]#Content data node#
  169. Content data nodes accommodate user-created content. They enable operations like CRUD,
  170. search and aggregations.
  171. To create a dedicated content node, set:
  172. [source,yaml]
  173. ----
  174. node.roles: [ data_content ]
  175. ----
  176. [[data-hot-node]]
  177. ==== [x-pack]#Hot data node#
  178. Hot data nodes store time series data as it enters {es}. The hot tier must be fast for
  179. both reads and writes, and requires more hardware resources (such as SSD drives).
  180. To create a dedicated hot node, set:
  181. [source,yaml]
  182. ----
  183. node.roles: [ data_hot ]
  184. ----
  185. [[data-warm-node]]
  186. ==== [x-pack]#Warm data node#
  187. Warm data nodes store indices that are no longer being regularly updated, but are still being
  188. queried. Query volume is usually at a lower frequency than it was while the index was in the hot tier.
  189. Less performant hardware can usually be used for nodes in this tier.
  190. To create a dedicated warm node, set:
  191. [source,yaml]
  192. ----
  193. node.roles: [ data_warm ]
  194. ----
  195. [[data-cold-node]]
  196. ==== [x-pack]#Cold data node#
  197. 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.
  198. To create a dedicated cold node, set:
  199. [source,yaml]
  200. ----
  201. node.roles: [ data_cold ]
  202. ----
  203. [[node-ingest-node]]
  204. ==== Ingest node
  205. Ingest nodes can execute pre-processing pipelines, composed of one or more
  206. ingest processors. Depending on the type of operations performed by the ingest
  207. processors and the required resources, it may make sense to have dedicated
  208. ingest nodes, that will only perform this specific task.
  209. To create a dedicated ingest node, set:
  210. [source,yaml]
  211. ----
  212. node.roles: [ ingest ]
  213. ----
  214. [[coordinating-only-node]]
  215. ==== Coordinating only node
  216. If you take away the ability to be able to handle master duties, to hold data,
  217. and pre-process documents, then you are left with a _coordinating_ node that
  218. can only route requests, handle the search reduce phase, and distribute bulk
  219. indexing. Essentially, coordinating only nodes behave as smart load balancers.
  220. Coordinating only nodes can benefit large clusters by offloading the
  221. coordinating node role from data and master-eligible nodes. They join the
  222. cluster and receive the full <<cluster-state,cluster state>>, like every other
  223. node, and they use the cluster state to route requests directly to the
  224. appropriate place(s).
  225. WARNING: Adding too many coordinating only nodes to a cluster can increase the
  226. burden on the entire cluster because the elected master node must await
  227. acknowledgement of cluster state updates from every node! The benefit of
  228. coordinating only nodes should not be overstated -- data nodes can happily
  229. serve the same purpose.
  230. To create a dedicated coordinating node, set:
  231. [source,yaml]
  232. ----
  233. node.roles: [ ]
  234. ----
  235. [[remote-node]]
  236. ==== Remote-eligible node
  237. By default, any node in a cluster can act as a cross-cluster client and connect
  238. to <<modules-remote-clusters,remote clusters>>. Once connected, you can search
  239. remote clusters using <<modules-cross-cluster-search,{ccs}>>. You can also sync
  240. data between clusters using <<xpack-ccr,{ccr}>>.
  241. [source,yaml]
  242. ----
  243. node.roles: [ remote_cluster_client ]
  244. ----
  245. [[ml-node]]
  246. ==== [xpack]#Machine learning node#
  247. The {ml-features} provide {ml} nodes, which run jobs and handle {ml} API
  248. requests. If `xpack.ml.enabled` is set to `true` and the node does not have the
  249. `ml` role, the node can service API requests but it cannot run jobs.
  250. If you want to use {ml-features} in your cluster, you must enable {ml}
  251. (set `xpack.ml.enabled` to `true`) on all master-eligible nodes. If you want to
  252. use {ml-features} in clients (including {kib}), it must also be enabled on all
  253. coordinating nodes. If you have the {oss-dist}, do not use these settings.
  254. For more information about these settings, see <<ml-settings>>.
  255. To create a dedicated {ml} node in the {default-dist}, set:
  256. [source,yaml]
  257. ----
  258. node.roles: [ ml, remote_cluster_client] <1>
  259. xpack.ml.enabled: true <2>
  260. ----
  261. <1> The `remote_cluster_client` role is optional but strongly recommended.
  262. Otherwise, {ccs} fails when used in {ml} jobs or {dfeeds}. See <<remote-node>>.
  263. <2> The `xpack.ml.enabled` setting is enabled by default.
  264. [[transform-node]]
  265. ==== [xpack]#{transform-cap} node#
  266. {transform-cap} nodes run {transforms} and handle {transform} API requests. If
  267. you have the {oss-dist}, do not use these settings. For more information, see
  268. <<transform-settings>>.
  269. To create a dedicated {transform} node in the {default-dist}, set:
  270. [source,yaml]
  271. ----
  272. node.roles: [ transform, remote_cluster_client ] <1>
  273. ----
  274. <1> The `remote_cluster_client` role is optional but strongly recommended.
  275. Otherwise, {ccs} fails when used in {transforms}. See <<remote-node>>.
  276. [[change-node-role]]
  277. ==== Changing the role of a node
  278. Each data node maintains the following data on disk:
  279. * the shard data for every shard allocated to that node,
  280. * the index metadata corresponding with every shard allocated to that node, and
  281. * the cluster-wide metadata, such as settings and index templates.
  282. Similarly, each master-eligible node maintains the following data on disk:
  283. * the index metadata for every index in the cluster, and
  284. * the cluster-wide metadata, such as settings and index templates.
  285. Each node checks the contents of its data path at startup. If it discovers
  286. unexpected data then it will refuse to start. This is to avoid importing
  287. unwanted <<modules-gateway-dangling-indices,dangling indices>> which can lead
  288. to a red cluster health. To be more precise, nodes without the `data` role will
  289. refuse to start if they find any shard data on disk at startup, and nodes
  290. without both the `master` and `data` roles will refuse to start if they have any
  291. index metadata on disk at startup.
  292. It is possible to change the roles of a node by adjusting its
  293. `elasticsearch.yml` file and restarting it. This is known as _repurposing_ a
  294. node. In order to satisfy the checks for unexpected data described above, you
  295. must perform some extra steps to prepare a node for repurposing when starting
  296. the node without the `data` or `master` roles.
  297. * If you want to repurpose a data node by removing the `data` role then you
  298. should first use an <<allocation-filtering,allocation filter>> to safely
  299. migrate all the shard data onto other nodes in the cluster.
  300. * If you want to repurpose a node to have neither the `data` nor `master` roles
  301. then it is simplest to start a brand-new node with an empty data path and the
  302. desired roles. You may find it safest to use an
  303. <<allocation-filtering,allocation filter>> to migrate the shard data elsewhere
  304. in the cluster first.
  305. If it is not possible to follow these extra steps then you may be able to use
  306. the <<node-tool-repurpose,`elasticsearch-node repurpose`>> tool to delete any
  307. excess data that prevents a node from starting.
  308. [discrete]
  309. === Node data path settings
  310. [[data-path]]
  311. ==== `path.data`
  312. Every data and master-eligible node requires access to a data directory where
  313. shards and index and cluster metadata will be stored. The `path.data` defaults
  314. to `$ES_HOME/data` but can be configured in the `elasticsearch.yml` config
  315. file an absolute path or a path relative to `$ES_HOME` as follows:
  316. [source,yaml]
  317. ----
  318. path.data: /var/elasticsearch/data
  319. ----
  320. Like all node settings, it can also be specified on the command line as:
  321. [source,sh]
  322. ----
  323. ./bin/elasticsearch -Epath.data=/var/elasticsearch/data
  324. ----
  325. TIP: When using the `.zip` or `.tar.gz` distributions, the `path.data` setting
  326. should be configured to locate the data directory outside the {es} home
  327. directory, so that the home directory can be deleted without deleting your data!
  328. The RPM and Debian distributions do this for you already.
  329. [discrete]
  330. [[other-node-settings]]
  331. === Other node settings
  332. More node settings can be found in <<settings>> and <<important-settings>>,
  333. including:
  334. * <<cluster-name,`cluster.name`>>
  335. * <<node-name,`node.name`>>
  336. * <<modules-network,network settings>>