shutdown-get.asciidoc 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. [[get-shutdown]]
  2. === Get shutdown API
  3. NOTE: {cloud-only}
  4. Retrieves the status of a node that's being prepared for shutdown.
  5. [[get-shutdown-api-request]]
  6. ==== {api-request-title}
  7. `GET _nodes/shutdown`
  8. `GET _nodes/<node-id>/shutdown`
  9. [[get-shutdown-api-prereqs]]
  10. ==== {api-prereq-title}
  11. * If the {es} {security-features} are enabled, you must have the `manage`
  12. <<privileges-list-cluster,cluster privilege>> to use this API.
  13. * If the <<operator-privileges,{operator-feature}>> is enabled,
  14. you must be an operator to use this API.
  15. [[get-shutdown-api-desc]]
  16. ==== {api-description-title}
  17. Indicates whether a node is ready to be shut down, or if shut down preparations
  18. are still in progress or have stalled.
  19. Returns status information for each part of the shut down process.
  20. Use to monitor the shut down process after calling <<put-shutdown, put shutdown>>.
  21. [[get-shutdown-api-path-params]]
  22. ==== {api-path-parms-title}
  23. `<node-id>`::
  24. (Optional, string)
  25. The ID of a node that is being prepared for shutdown.
  26. If no ID is specified, returns the status of all nodes being prepared for shutdown.
  27. [[get-shutdown-api-params]]
  28. ==== {api-query-parms-title}
  29. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]
  30. [[get-shutdown-api-example]]
  31. ==== {api-examples-title}
  32. Prepare a node to be restarted:
  33. [source,console]
  34. --------------------------------------------------
  35. PUT /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown
  36. {
  37. "type": "restart",
  38. "reason": "Demonstrating how the node shutdown API works",
  39. "allocation_delay": "10m"
  40. }
  41. --------------------------------------------------
  42. Get the status of the shutdown preparations:
  43. [source,console]
  44. --------------------------------------------------
  45. GET /_nodes/USpTGYaBSIKbgSUJR2Z9lg/shutdown
  46. --------------------------------------------------
  47. // TEST[continued]
  48. The response shows information about the shutdown preparations,
  49. including the status of shard migration, task migration, and plugin cleanup:
  50. [source,console-result]
  51. --------------------------------------------------
  52. {
  53. "nodes": [
  54. {
  55. "node_id": "USpTGYaBSIKbgSUJR2Z9lg",
  56. "type": "RESTART",
  57. "reason": "Demonstrating how the node shutdown API works",
  58. "shutdown_startedmillis": 1624406108685,
  59. "allocation_delay": "10m",
  60. "status": "COMPLETE",
  61. "shard_migration": {
  62. "status": "COMPLETE",
  63. "shard_migrations_remaining": 0,
  64. "explanation": "no shard relocation is necessary for a node restart"
  65. },
  66. "persistent_tasks": {
  67. "status": "COMPLETE"
  68. },
  69. "plugins": {
  70. "status": "COMPLETE"
  71. }
  72. }
  73. ]
  74. }
  75. --------------------------------------------------
  76. // TESTRESPONSE[s/1624406108685/$body.nodes.0.shutdown_startedmillis/]
  77. // TESTRESPONSE[s/USpTGYaBSIKbgSUJR2Z9lg/$body.nodes.0.node_id/]