migrate-to-data-tiers.asciidoc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[ilm-migrate-to-data-tiers]]
  4. === Migrate to data tiers routing API
  5. ++++
  6. <titleabbrev>Migrate indices and ILM policies to data tiers routing</titleabbrev>
  7. ++++
  8. Switches the indices and ILM policies from using custom node attributes and
  9. <<shard-allocation-filtering, attribute-based allocation filters>> to using <<data-tiers, data tiers>>, and
  10. optionally deletes one legacy index template.
  11. Using node roles enables {ilm-init} to <<data-tier-migration, automatically move the indices>> between
  12. data tiers.
  13. Migrating away from custom node attributes routing can be manually performed
  14. as indicated in the <<migrate-index-allocation-filters, Migrate index allocation
  15. filters to node roles>> page.
  16. This API provides an automated way of executing three out of the four manual steps listed
  17. in the <<data-tier-migration, migration guide>>:
  18. . <<stop-setting-custom-hot-attribute, Stop setting the custom hot attribute on new indices>>
  19. . <<remove-custom-allocation-settings, Remove custom allocation settings from existing {ilm-init} policies>>
  20. . <<set-tier-preference, Replace custom allocation settings from existing indices>> with the corresponding <<data-tier-shard-filtering,tier preference>>
  21. [[ilm-migrate-to-data-tiers-request]]
  22. ==== {api-request-title}
  23. `POST /_ilm/migrate_to_data_tiers`
  24. The API accepts an optional body that allows you to specify:
  25. - The legacy index template name to delete. Defaults to none.
  26. - The name of the custom node attribute used for the indices and ILM policies allocation filtering.
  27. Defaults to `data`.
  28. [[ilm-migrate-to-data-tiers-prereqs]]
  29. ==== {api-prereq-title}
  30. * {ilm-init} must be stopped before performing the migration. Use the <<ilm-stop-request, stop ILM API>>
  31. to stop {ilm-init} and <<ilm-get-status-request, get status API>> to wait until the
  32. reported operation mode is `STOPPED`.
  33. [[ilm-migrate-to-data-tiers-query-params]]
  34. ==== {api-query-parms-title}
  35. `dry_run`::
  36. (Optional, Boolean)
  37. If `true`, simulates the migration from node attributes based allocation filters to data tiers, but does
  38. not perform the migration. This provides a way to retrieve the indices and ILM policies that need to be
  39. migrated.
  40. Defaults to `false`.
  41. [[ilm-migrate-to-data-tiers-example]]
  42. ==== {api-examples-title}
  43. The following example migrates the indices and ILM policies away from defining
  44. custom allocation filtering using the `custom_attribute_name` node attribute, and
  45. deletes legacy template with name `global-template` if it exists in the system.
  46. ////
  47. [source,console]
  48. ----
  49. POST _ilm/stop
  50. PUT _template/global-template
  51. {
  52. "index_patterns": ["migrate-to-tiers-*"],
  53. "settings": {
  54. "index.routing.allocation.require.custom_attribute_name": "hot"
  55. }
  56. }
  57. PUT warm-index-to-migrate-000001
  58. {
  59. "settings": {
  60. "index.routing.allocation.require.custom_attribute_name": "warm"
  61. }
  62. }
  63. PUT _ilm/policy/policy_with_allocate_action
  64. {
  65. "policy": {
  66. "phases": {
  67. "warm": {
  68. "actions": {
  69. "allocate": {
  70. "require": {
  71. "custom_attribute_name": "warm"
  72. }
  73. }
  74. }
  75. },
  76. "delete": {
  77. "min_age": "30d",
  78. "actions": {
  79. "delete": {}
  80. }
  81. }
  82. }
  83. }
  84. }
  85. ----
  86. // TESTSETUP
  87. [source,console]
  88. ----
  89. DELETE warm-index-to-migrate-000001
  90. DELETE _ilm/policy/policy_with_allocate_action
  91. POST _ilm/start
  92. ----
  93. // TEARDOWN
  94. ////
  95. [source,console]
  96. ----------------------------------------------------------------
  97. POST /_ilm/migrate_to_data_tiers
  98. {
  99. "legacy_template_to_delete": "global-template",
  100. "node_attribute": "custom_attribute_name"
  101. }
  102. ----------------------------------------------------------------
  103. If the request succeeds, a response like the following will be received:
  104. [source,console-result]
  105. ------------------------------------------------------------------------------
  106. {
  107. "dry_run": false,
  108. "removed_legacy_template":"global-template", <1>
  109. "migrated_ilm_policies":["policy_with_allocate_action"], <2>
  110. "migrated_indices":["warm-index-to-migrate-000001"] <3>
  111. }
  112. ------------------------------------------------------------------------------
  113. <1> Shows the name of the legacy index template that was deleted. This will be missing
  114. if no legacy index template was deleted.
  115. <2> The ILM policies that were updated.
  116. <3> The indices that were migrated to <<data-tier-shard-filtering,tier preference>> routing.