start-stop.asciidoc 3.4 KB

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