migrate-index-allocation-filters.asciidoc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. [role="xpack"]
  2. [[migrate-index-allocation-filters]]
  3. == Migrate index allocation filters to node roles
  4. If you currently use custom node attributes and
  5. <<shard-allocation-filtering, attribute-based allocation filters>> to
  6. move indices through <<data-tiers, data tiers>> in a
  7. https://www.elastic.co/blog/implementing-hot-warm-cold-in-elasticsearch-with-index-lifecycle-management[hot-warm-cold architecture],
  8. we recommend that you switch to using the built-in node roles
  9. and automatic <<data-tier-allocation, data tier allocation>>.
  10. Using node roles enables {ilm-init} to automatically
  11. move indices between data tiers.
  12. NOTE: While we recommend relying on automatic data tier allocation to manage
  13. your data in a hot-warm-cold architecture,
  14. you can still use attribute-based allocation filters to
  15. control shard allocation for other purposes.
  16. To switch to using node roles:
  17. . <<assign-data-tier, Assign data nodes>> to the appropriate data tier.
  18. . <<remove-custom-allocation-settings, Remove the attribute-based allocation
  19. settings>> from your {ilm} policy.
  20. . <<stop-setting-custom-hot-attribute, Stop setting the custom hot attribute>>
  21. on new indices.
  22. . Update existing indices to <<set-tier-preference, set a tier preference>>.
  23. [discrete]
  24. [[assign-data-tier]]
  25. === Assign data nodes to a data tier
  26. Configure the appropriate roles for each data node to assign it to one or more
  27. data tiers: `data_hot`, `data_content`, `data_warm`, `data_cold`, or `data_frozen`.
  28. A node can also have other <<modules-node,roles>>. By default, new nodes are
  29. configured with all roles.
  30. When you add a data tier to an {ess} deployment,
  31. one or more nodes are automatically configured with the corresponding role.
  32. To explicitly change the role of a node in an {ess} deployment, use the
  33. {cloud}/ec-api-deployment-crud.html#ec_update_a_deployment[Update deployment API].
  34. Replace the node's `node_type` configuration with the appropriate `node_roles`.
  35. For example, the following configuration adds the node to the hot and content
  36. tiers, and enables it to act as an ingest node, remote, and transform node.
  37. [source,yaml]
  38. ----
  39. "node_roles": [
  40. "data_hot",
  41. "data_content",
  42. "ingest",
  43. "remote_cluster_client",
  44. "transform"
  45. ],
  46. ----
  47. If you are directly managing your own cluster,
  48. configure the appropriate roles for each node in `elasticsearch.yml`.
  49. For example, the following setting configures a node to be a data-only
  50. node in the hot and content tiers.
  51. [source,yaml]
  52. ----
  53. node.roles [ data_hot, data_content ]
  54. ----
  55. [discrete]
  56. [[remove-custom-allocation-settings]]
  57. === Remove custom allocation settings from existing {ilm-init} policies
  58. Update the allocate action for each lifecycle phase to remove the attribute-based
  59. allocation settings. This enables {ilm-init} to inject the
  60. <<ilm-migrate,migrate>> action into each phase
  61. to automatically transition the indices through the data tiers.
  62. If the allocate action does not set the number of replicas,
  63. remove the allocate action entirely. (An empty allocate action is invalid.)
  64. IMPORTANT: The policy must specify the corresponding phase for each data tier in
  65. your architecture. Each phase must be present so {ilm-init} can inject the
  66. migrate action to move indices through the data tiers.
  67. If you don't need to perform any other actions, the phase can be empty.
  68. For example, if you enable the warm and cold data tiers for a deployment,
  69. your policy must include the hot, warm, and cold phases.
  70. [discrete]
  71. [[stop-setting-custom-hot-attribute]]
  72. === Stop setting the custom hot attribute on new indices
  73. When you create a data stream, its first backing index
  74. is now automatically assigned to `data_hot` nodes.
  75. Similarly, when you directly create an index, it
  76. is automatically assigned to `data_content` nodes.
  77. On {ess} deployments, remove the `cloud-hot-warm-allocation-0` index template
  78. that set the hot shard allocation attribute on all indices.
  79. [source,console]
  80. ----
  81. DELETE _template/.cloud-hot-warm-allocation-0
  82. ----
  83. // TEST[skip:no cloud template]
  84. If you're using a custom index template, update it to remove the <<shard-allocation-filtering, attribute-based allocation filters>> you used to assign new indices to the hot tier.
  85. [discrete]
  86. [[set-tier-preference]]
  87. === Set a tier preference for existing indices.
  88. {ilm-init} automatically transitions managed indices through the available
  89. data tiers by automatically injecting a <<ilm-migrate,migrate action>>
  90. into each phase.
  91. To enable {ilm-init} to move an _existing_ managed index
  92. through the data tiers, update the index settings to:
  93. . Remove the custom allocation filter by setting it to `null`.
  94. . Set the <<data-tier-shard-filtering,tier preference>>.
  95. For example, if your old template set the `data` attribute to `hot`
  96. to allocate shards to the hot tier, set the `data` attribute to `null`
  97. and set the `_tier_preference` to `data_hot`.
  98. ////
  99. [source,console]
  100. ----
  101. PUT /my-index
  102. PUT /my-index/_settings
  103. {
  104. "index.routing.allocation.require.data": "hot"
  105. }
  106. ----
  107. ////
  108. [source,console]
  109. ----
  110. PUT my-index/_settings
  111. {
  112. "index.routing.allocation.require.data": null,
  113. "index.routing.allocation.include._tier_preference": "data_hot"
  114. }
  115. ----
  116. // TEST[continued]
  117. For indices that have already transitioned out of the hot phase,
  118. the tier preference should include the appropriate fallback tiers
  119. to ensure index shards can be allocated if the preferred tier
  120. is unavailable.
  121. For example, specify the hot tier as the fallback for indices
  122. already in the warm phase.
  123. [source,console]
  124. ----
  125. PUT my-index/_settings
  126. {
  127. "index.routing.allocation.require.data": null,
  128. "index.routing.allocation.include._tier_preference": "data_warm,data_hot"
  129. }
  130. ----
  131. // TEST[continued]
  132. If an index is already in the cold phase, include the cold, warm, and hot tiers.