update-desired-nodes.asciidoc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. [[update-desired-nodes]]
  2. === Create or update desired nodes API
  3. ++++
  4. <titleabbrev>Create or update desired nodes</titleabbrev>
  5. ++++
  6. NOTE: {cloud-only}
  7. Creates or updates the desired nodes.
  8. [[update-desired-nodes-request]]
  9. ==== {api-request-title}
  10. [source,console]
  11. --------------------------------------------------
  12. PUT /_internal/desired_nodes/<history_id>/<version>
  13. {
  14. "nodes" : [
  15. {
  16. "settings" : {
  17. "node.name" : "instance-000187",
  18. "node.external_id": "instance-000187",
  19. "node.roles" : ["data_hot", "master"],
  20. "node.attr.data" : "hot",
  21. "node.attr.logical_availability_zone" : "zone-0"
  22. },
  23. "processors" : 8.0,
  24. "memory" : "58gb",
  25. "storage" : "2tb",
  26. "node_version" : "{version}"
  27. }
  28. ]
  29. }
  30. --------------------------------------------------
  31. // TEST[s/<history_id>/test/]
  32. // TEST[s/<version>/1/]
  33. //////////////////////////
  34. [source,console]
  35. --------------------------------------------------
  36. DELETE /_internal/desired_nodes
  37. --------------------------------------------------
  38. // TEST[continued]
  39. //////////////////////////
  40. [[update-desired-nodes-query-params]]
  41. ==== {api-query-parms-title}
  42. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  43. `dry_run`::
  44. (Optional, Boolean) If `true`, then the request simulates the update and
  45. returns a response with `dry_run` field set to `true`.
  46. [[update-desired-nodes-desc]]
  47. ==== {api-description-title}
  48. This API creates or update the desired nodes. External orchestrators can use
  49. this API to let Elasticsearch know about the cluster topology, including future
  50. changes such as adding or removing nodes. Using this information, the system is
  51. able to take better decisions.
  52. It's possible to run the update in "dry run" mode by adding the
  53. `?dry_run` query parameter. This will validate the request result, but will not actually perform the update.
  54. [[update-desired-nodes-examples]]
  55. ==== {api-examples-title}
  56. In this example, a new version for the desired nodes with history `Ywkh3INLQcuPT49f6kcppA` is created.
  57. This API only accepts monotonically increasing versions.
  58. [source,console]
  59. --------------------------------------------------
  60. PUT /_internal/desired_nodes/Ywkh3INLQcuPT49f6kcppA/100
  61. {
  62. "nodes" : [
  63. {
  64. "settings" : {
  65. "node.name" : "instance-000187",
  66. "node.external_id": "instance-000187",
  67. "node.roles" : ["data_hot", "master"],
  68. "node.attr.data" : "hot",
  69. "node.attr.logical_availability_zone" : "zone-0"
  70. },
  71. "processors" : 8.0,
  72. "memory" : "58gb",
  73. "storage" : "2tb",
  74. "node_version" : "{version}"
  75. }
  76. ]
  77. }
  78. --------------------------------------------------
  79. // TEST
  80. The API returns the following result:
  81. [source,console-result]
  82. --------------------------------------------------
  83. {
  84. "replaced_existing_history_id": false,
  85. "dry_run": false
  86. }
  87. --------------------------------------------------
  88. Additionally, it is possible to specify a processors range.
  89. This is helpful in environments where Elasticsearch nodes can
  90. be deployed in hosts where the number of processors that the
  91. Elasticsearch process can use is guaranteed to be at least the
  92. lower range and up to the upper range. This is a common scenario
  93. in Linux deployments where cgroups is used.
  94. [source,console]
  95. --------------------------------------------------
  96. PUT /_internal/desired_nodes/Ywkh3INLQcuPT49f6kcppA/101
  97. {
  98. "nodes" : [
  99. {
  100. "settings" : {
  101. "node.name" : "instance-000187",
  102. "node.external_id": "instance-000187",
  103. "node.roles" : ["data_hot", "master"],
  104. "node.attr.data" : "hot",
  105. "node.attr.logical_availability_zone" : "zone-0"
  106. },
  107. "processors_range" : {"min": 8.0, "max": 10.0},
  108. "memory" : "58gb",
  109. "storage" : "2tb",
  110. "node_version" : "{version}"
  111. }
  112. ]
  113. }
  114. --------------------------------------------------
  115. //////////////////////////
  116. [source,console]
  117. --------------------------------------------------
  118. DELETE /_internal/desired_nodes
  119. --------------------------------------------------
  120. // TEST[continued]
  121. //////////////////////////