shutdown-put.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. [[put-shutdown]]
  2. === Put shutdown API
  3. NOTE: {cloud-only}
  4. Prepares a node to be shut down.
  5. [[put-shutdown-api-request]]
  6. ==== {api-request-title}
  7. `PUT _nodes/<node-id>/shutdown`
  8. [[put-shutdown-api-prereqs]]
  9. ==== {api-prereq-title}
  10. * If the {es} {security-features} are enabled, you must have the `manage`
  11. <<privileges-list-cluster,cluster privilege>> to use this API.
  12. * If the <<operator-privileges,{operator-feature}>> is enabled, you must be an operator
  13. to use this API.
  14. [[put-shutdown-api-desc]]
  15. ==== {api-description-title}
  16. Migrates ongoing tasks and index shards to other nodes as needed
  17. to prepare a node to be restarted or shut down and removed from the cluster.
  18. This ensures that {es} can be stopped safely with minimal disruption to the cluster.
  19. You must specify the type of shutdown: `restart` or `remove`.
  20. If a node is already being prepared for shutdown,
  21. you can use this API to change the shutdown type.
  22. IMPORTANT: This API does *NOT* terminate the {es} process.
  23. Monitor the <<get-shutdown,node shutdown status>> to determine
  24. when it is safe to stop {es}.
  25. [[put-shutdown-api-path-params]]
  26. ==== {api-path-parms-title}
  27. `<node-id>`::
  28. (Required, string)
  29. The ID of the node you want to prepare for shutdown.
  30. If you specify a node that is offline,
  31. it will be prepared for shut down when it rejoins the cluster.
  32. IMPORTANT: This parameter is *NOT* validated against the cluster's active nodes.
  33. This enables you to register a node for shut down while it is offline.
  34. No error is thrown if you specify an invalid node ID.
  35. [[put-shutdown-api-params]]
  36. ==== {api-query-parms-title}
  37. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  38. [role="child_attributes"]
  39. [[put-shutdown-api-request-body]]
  40. ==== {api-request-body-title}
  41. `type`::
  42. (Required, string)
  43. Valid values are `restart` and `remove`.
  44. Use `restart` when you need to temporarily shut down a node to perform an upgrade,
  45. make configuration changes, or perform other maintenance.
  46. Because the node is expected to rejoin the cluster, data is not migrated off of the node.
  47. Use `remove` when you need to permanently remove a node from the cluster.
  48. The node is not marked ready for shutdown until data is migrated off of the node
  49. `reason`::
  50. (Required, string)
  51. A human-readable reason that the node is being shut down.
  52. This field provides information for other cluster operators;
  53. it does not affect the shut down process.
  54. `allocation_delay`::
  55. (Optional, string)
  56. Only valid if `type` is `restart`. Controls how long {es} will wait for the node to restart and join the cluster before reassigning its shards to other nodes. This works the same as
  57. <<delayed-allocation,delaying allocation>> with the `index.unassigned.node_left.delayed_timeout` setting. If you specify both a restart allocation delay and an index-level allocation delay, the longer of the two is used.
  58. [[put-shutdown-api-example]]
  59. ==== {api-examples-title}
  60. Register a node for shutdown:
  61. [source,console]
  62. --------------------------------------------------
  63. PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown
  64. {
  65. "type": "restart", <1>
  66. "reason": "Demonstrating how the node shutdown API works",
  67. "allocation_delay": "20m"
  68. }
  69. --------------------------------------------------
  70. ////
  71. [source,console-result]
  72. --------------------------------------------------
  73. {
  74. "acknowledged": true
  75. }
  76. --------------------------------------------------
  77. ////
  78. <1> Prepares the node to be restarted.
  79. Use `remove` for nodes that will be permanently removed from the cluster.