migrate-index-allocation-filters.asciidoc 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. {ess} and {ece} can perform the migration automatically. For self-managed
  17. deployments, you need to manually update your configuration, ILM policies, and
  18. indices to switch to node roles.
  19. [discrete]
  20. [[cloud-migrate-to-node-roles]]
  21. === Automatically migrate to node roles on {ess} or {ece}
  22. If you are using node attributes on {ess} or {ece}, you will be
  23. prompted to switch to node roles when you:
  24. * Upgrade to {es} 7.10 or higher
  25. * Deploy a warm, cold, or frozen data tier
  26. * {cloud}/ec-autoscaling.html[Enable autoscaling]
  27. These actions automatically update your cluster configuration
  28. and {ilm-init} policies to use node roles. Additionally, upgrading to
  29. version 7.14 or higher automatically update {ilm-init} policies
  30. whenever any configuration change is applied to your deployment.
  31. If you use custom index templates, check them after the automatic migration
  32. completes and remove any <<shard-allocation-filtering, attribute-based
  33. allocation filters>>.
  34. NOTE: You do not need to take any further action after the automatic migration.
  35. The following manual steps are only necessary if you do not allow the automatic
  36. migration or have a self-managed deployment.
  37. [discrete]
  38. [[on-prem-migrate-to-node-roles]]
  39. === Migrate to node roles on self-managed deployments
  40. To switch to using node roles:
  41. . <<assign-data-tier, Assign data nodes>> to the appropriate data tier.
  42. . <<remove-custom-allocation-settings, Remove the attribute-based allocation
  43. settings>> from your {ilm} policy.
  44. . <<stop-setting-custom-hot-attribute, Stop setting the custom hot attribute>>
  45. on new indices.
  46. . Update existing indices to <<set-tier-preference, set a tier preference>>.
  47. [discrete]
  48. [[assign-data-tier]]
  49. ==== Assign data nodes to a data tier
  50. Configure the appropriate roles for each data node to assign it to one or more
  51. data tiers: `data_hot`, `data_content`, `data_warm`, `data_cold`, or `data_frozen`.
  52. A node can also have other <<modules-node,roles>>. By default, new nodes are
  53. configured with all roles.
  54. When you add a data tier to an {ess} deployment,
  55. one or more nodes are automatically configured with the corresponding role.
  56. To explicitly change the role of a node in an {ess} deployment, use the
  57. {cloud}/ec-api-deployment-crud.html#ec_update_a_deployment[Update deployment API].
  58. Replace the node's `node_type` configuration with the appropriate `node_roles`.
  59. For example, the following configuration adds the node to the hot and content
  60. tiers, and enables it to act as an ingest node, remote, and transform node.
  61. [source,yaml]
  62. ----
  63. "node_roles": [
  64. "data_hot",
  65. "data_content",
  66. "ingest",
  67. "remote_cluster_client",
  68. "transform"
  69. ],
  70. ----
  71. If you are directly managing your own cluster,
  72. configure the appropriate roles for each node in `elasticsearch.yml`.
  73. For example, the following setting configures a node to be a data-only
  74. node in the hot and content tiers.
  75. [source,yaml]
  76. ----
  77. node.roles [ data_hot, data_content ]
  78. ----
  79. [discrete]
  80. [[remove-custom-allocation-settings]]
  81. ==== Remove custom allocation settings from existing {ilm-init} policies
  82. Update the allocate action for each lifecycle phase to remove the attribute-based
  83. allocation settings. {ilm-init} will inject a
  84. <<ilm-migrate,migrate>> action into each phase
  85. to automatically transition the indices through the data tiers.
  86. If the allocate action does not set the number of replicas,
  87. remove the allocate action entirely. (An empty allocate action is invalid.)
  88. IMPORTANT: The policy must specify the corresponding phase for each data tier in
  89. your architecture. Each phase must be present so {ilm-init} can inject the
  90. migrate action to move indices through the data tiers.
  91. If you don't need to perform any other actions, the phase can be empty.
  92. For example, if you enable the warm and cold data tiers for a deployment,
  93. your policy must include the hot, warm, and cold phases.
  94. [discrete]
  95. [[stop-setting-custom-hot-attribute]]
  96. ==== Stop setting the custom hot attribute on new indices
  97. When you create a data stream, its first backing index
  98. is now automatically assigned to `data_hot` nodes.
  99. Similarly, when you directly create an index, it
  100. is automatically assigned to `data_content` nodes.
  101. On {ess} deployments, remove the `cloud-hot-warm-allocation-0` index template
  102. that set the hot shard allocation attribute on all indices.
  103. [source,console]
  104. ----
  105. DELETE _template/.cloud-hot-warm-allocation-0
  106. ----
  107. // TEST[skip:no cloud template]
  108. 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.
  109. [discrete]
  110. [[set-tier-preference]]
  111. ==== Set a tier preference for existing indices.
  112. {ilm-init} automatically transitions managed indices through the available
  113. data tiers by automatically injecting a <<ilm-migrate,migrate action>>
  114. into each phase.
  115. To enable {ilm-init} to move an _existing_ managed index
  116. through the data tiers, update the index settings to:
  117. . Remove the custom allocation filter by setting it to `null`.
  118. . Set the <<data-tier-shard-filtering,tier preference>>.
  119. For example, if your old template set the `data` attribute to `hot`
  120. to allocate shards to the hot tier, set the `data` attribute to `null`
  121. and set the `_tier_preference` to `data_hot`.
  122. ////
  123. [source,console]
  124. ----
  125. PUT /my-index
  126. PUT /my-index/_settings
  127. {
  128. "index.routing.allocation.require.data": "hot"
  129. }
  130. ----
  131. ////
  132. [source,console]
  133. ----
  134. PUT my-index/_settings
  135. {
  136. "index.routing.allocation.require.data": null,
  137. "index.routing.allocation.include._tier_preference": "data_hot"
  138. }
  139. ----
  140. // TEST[continued]
  141. For indices that have already transitioned out of the hot phase,
  142. the tier preference should include the appropriate fallback tiers
  143. to ensure index shards can be allocated if the preferred tier
  144. is unavailable.
  145. For example, specify the hot tier as the fallback for indices
  146. already in the warm phase.
  147. [source,console]
  148. ----
  149. PUT my-index/_settings
  150. {
  151. "index.routing.allocation.require.data": null,
  152. "index.routing.allocation.include._tier_preference": "data_warm,data_hot"
  153. }
  154. ----
  155. // TEST[continued]
  156. If an index is already in the cold phase, include the cold, warm, and hot tiers.