node.asciidoc 15 KB

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