start-stop-ilm.asciidoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[start-stop-ilm]]
  4. == Start and stop {ilm}
  5. All indices that are managed by ILM will continue to execute
  6. their policies. There may be times when this is not desired on certain
  7. indices, or maybe even all the indices in a cluster. For example,
  8. maybe there are scheduled maintenance windows when cluster topology
  9. changes are desired that may impact running ILM actions. For this reason,
  10. ILM has two ways to disable operations.
  11. When stopping ILM, snapshot lifecycle management operations are also stopped,
  12. this means that no scheduled snapshots are created (currently ongoing snapshots
  13. are unaffected).
  14. Normally, ILM will be running by default.
  15. To see the current operating status of ILM, use the <<ilm-get-status,Get Status API>>
  16. to see the current state of ILM.
  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
  42. {
  43. "settings": {
  44. "index.lifecycle.name": "my_policy"
  45. }
  46. }
  47. --------------------------------------------------
  48. ////
  49. [source,console]
  50. --------------------------------------------------
  51. GET _ilm/status
  52. --------------------------------------------------
  53. If the request does not encounter errors, you receive the following result:
  54. [source,console-result]
  55. --------------------------------------------------
  56. {
  57. "operation_mode": "RUNNING"
  58. }
  59. --------------------------------------------------
  60. The operating modes of ILM:
  61. [[ilm-operating-modes]]
  62. .ILM Operating Modes
  63. [options="header"]
  64. |===
  65. |Name |Description
  66. |RUNNING |Normal operation where all policies are executed as normal
  67. |STOPPING|ILM has received a request to stop but is still processing some policies
  68. |STOPPED |This represents a state where no policies are executed
  69. |===
  70. [float]
  71. === Stopping ILM=
  72. The ILM service can be paused such that no further steps will be executed
  73. using the <<ilm-stop,Stop API>>.
  74. [source,console]
  75. --------------------------------------------------
  76. POST _ilm/stop
  77. --------------------------------------------------
  78. // TEST[continued]
  79. When stopped, all further policy actions will be halted. This will
  80. be reflected in the Status API
  81. ////
  82. [source,console]
  83. --------------------------------------------------
  84. GET _ilm/status
  85. --------------------------------------------------
  86. // TEST[continued]
  87. ////
  88. [source,console-result]
  89. --------------------------------------------------
  90. {
  91. "operation_mode": "STOPPING"
  92. }
  93. --------------------------------------------------
  94. // TESTRESPONSE[s/"STOPPING"/$body.operation_mode/]
  95. The ILM service will then, asynchronously, run all policies to a point
  96. where it is safe to stop. After ILM verifies that it is safe, it will
  97. move to the `STOPPED` mode.
  98. ////
  99. [source,console]
  100. --------------------------------------------------
  101. PUT trigger_ilm_cs_action
  102. GET _ilm/status
  103. --------------------------------------------------
  104. // TEST[continued]
  105. ////
  106. [source,console-result]
  107. --------------------------------------------------
  108. {
  109. "operation_mode": "STOPPED"
  110. }
  111. --------------------------------------------------
  112. // TESTRESPONSE[s/"STOPPED"/$body.operation_mode/]
  113. [float]
  114. === Starting ILM
  115. To start ILM and continue executing policies, use the <<ilm-start, Start API>>.
  116. [source,console]
  117. --------------------------------------------------
  118. POST _ilm/start
  119. --------------------------------------------------
  120. // TEST[continued]
  121. ////
  122. [source,console]
  123. --------------------------------------------------
  124. GET _ilm/status
  125. --------------------------------------------------
  126. // TEST[continued]
  127. ////
  128. The Start API will send a request to the ILM service to immediately begin
  129. normal operations.
  130. [source,console-result]
  131. --------------------------------------------------
  132. {
  133. "operation_mode": "RUNNING"
  134. }
  135. --------------------------------------------------