node.asciidoc 20 KB

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