node.asciidoc 16 KB

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