start-stop.asciidoc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. [role="xpack"]
  2. [[start-stop-ilm]]
  3. == Start and stop {ilm}
  4. By default, the {ilm-init} service is in the `RUNNING` state and manages
  5. all indices that have lifecycle policies.
  6. You can stop {ilm} to suspend management operations for all indices.
  7. For example, you might stop {ilm} when performing scheduled maintenance or making
  8. changes to the cluster that could impact the execution of {ilm-init} actions.
  9. IMPORTANT: When you stop {ilm-init}, <<automate-snapshots-slm,{slm-init}>>
  10. operations are also suspended.
  11. No snapshots will be taken as scheduled until you restart {ilm-init}.
  12. In-progress snapshots are not affected.
  13. [discrete]
  14. [[get-ilm-status]]
  15. === Get {ilm-init} status
  16. To see the current status of the {ilm-init} service, use the <<ilm-get-status,Get Status API>>:
  17. ////
  18. [source,console]
  19. --------------------------------------------------
  20. PUT _ilm/policy/my_policy
  21. {
  22. "policy": {
  23. "phases": {
  24. "warm": {
  25. "min_age": "10d",
  26. "actions": {
  27. "forcemerge": {
  28. "max_num_segments": 1
  29. }
  30. }
  31. },
  32. "delete": {
  33. "min_age": "30d",
  34. "actions": {
  35. "delete": {}
  36. }
  37. }
  38. }
  39. }
  40. }
  41. PUT my-index-000001
  42. {
  43. "settings": {
  44. "index.lifecycle.name": "my_policy"
  45. }
  46. }
  47. --------------------------------------------------
  48. ////
  49. [source,console]
  50. --------------------------------------------------
  51. GET _ilm/status
  52. --------------------------------------------------
  53. Under normal operation, the response shows {ilm-init} is `RUNNING`:
  54. [source,console-result]
  55. --------------------------------------------------
  56. {
  57. "operation_mode": "RUNNING"
  58. }
  59. --------------------------------------------------
  60. [discrete]
  61. [[stop-ilm]]
  62. === Stop {ilm-init}
  63. To stop the {ilm-init} service and pause execution of all lifecycle policies,
  64. use the <<ilm-stop,Stop API>>:
  65. [source,console]
  66. --------------------------------------------------
  67. POST _ilm/stop
  68. --------------------------------------------------
  69. // TEST[continued]
  70. {ilm-init} service runs all policies to a point where it is safe to stop.
  71. While the {ilm-init} service is shutting down,
  72. the status API shows {ilm-init} is in the `STOPPING` mode:
  73. ////
  74. [source,console]
  75. --------------------------------------------------
  76. GET _ilm/status
  77. --------------------------------------------------
  78. // TEST[continued]
  79. ////
  80. [source,console-result]
  81. --------------------------------------------------
  82. {
  83. "operation_mode": "STOPPING"
  84. }
  85. --------------------------------------------------
  86. // TESTRESPONSE[s/"STOPPING"/$body.operation_mode/]
  87. Once all policies are at a safe stopping point, {ilm-init} moves into the `STOPPED` mode:
  88. ////
  89. [source,console]
  90. --------------------------------------------------
  91. PUT trigger_ilm_cs_action
  92. GET _ilm/status
  93. --------------------------------------------------
  94. // TEST[continued]
  95. ////
  96. [source,console-result]
  97. --------------------------------------------------
  98. {
  99. "operation_mode": "STOPPED"
  100. }
  101. --------------------------------------------------
  102. // TESTRESPONSE[s/"STOPPED"/$body.operation_mode/]
  103. [discrete]
  104. === Start {ilm-init}
  105. To restart {ilm-init} and resume executing policies, use the <<ilm-start, Start API>>.
  106. This puts the {ilm-init} service in the `RUNNING` state and
  107. {ilm-init} begins executing policies from where it left off.
  108. [source,console]
  109. --------------------------------------------------
  110. POST _ilm/start
  111. --------------------------------------------------
  112. // TEST[continued]