disk_allocator.asciidoc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. [[disk-based-shard-allocation]]
  2. ==== Disk-based shard allocation settings
  3. [[disk-based-shard-allocation-description]]
  4. // tag::disk-based-shard-allocation-description-tag[]
  5. The disk-based shard allocator ensures that all nodes have enough disk space
  6. without performing more shard movements than necessary. It allocates shards
  7. based on a pair of thresholds known as the _low watermark_ and the _high
  8. watermark_. Its primary goal is to ensure that no node exceeds the high
  9. watermark, or at least that any such overage is only temporary. If a node
  10. exceeds the high watermark then {es} will solve this by moving some of its
  11. shards onto other nodes in the cluster.
  12. NOTE: It is normal for nodes to temporarily exceed the high watermark from time
  13. to time.
  14. The allocator also tries to keep nodes clear of the high watermark by
  15. forbidding the allocation of more shards to a node that exceeds the low
  16. watermark. Importantly, if all of your nodes have exceeded the low watermark
  17. then no new shards can be allocated and {es} will not be able to move any
  18. shards between nodes in order to keep the disk usage below the high watermark.
  19. You must ensure that your cluster has enough disk space in total and that there
  20. are always some nodes below the low watermark.
  21. Shard movements triggered by the disk-based shard allocator must also satisfy
  22. all other shard allocation rules such as
  23. <<cluster-shard-allocation-filtering,allocation filtering>> and
  24. <<forced-awareness,forced awareness>>. If these rules are too strict then they
  25. can also prevent the shard movements needed to keep the nodes' disk usage under
  26. control. If you are using <<data-tiers,data tiers>> then {es} automatically
  27. configures allocation filtering rules to place shards within the appropriate
  28. tier, which means that the disk-based shard allocator works independently
  29. within each tier.
  30. If a node is filling up its disk faster than {es} can move shards elsewhere
  31. then there is a risk that the disk will completely fill up. To prevent this, as
  32. a last resort, once the disk usage reaches the _flood-stage_ watermark {es}
  33. will block writes to indices with a shard on the affected node. It will also
  34. continue to move shards onto the other nodes in the cluster. When disk usage
  35. on the affected node drops below the high watermark, {es} automatically removes
  36. the write block. Refer to <<fix-watermark-errors,Fix watermark errors>> to
  37. resolve persistent watermark errors.
  38. [NOTE]
  39. .Max headroom settings
  40. ===================================================
  41. Max headroom settings apply only when watermark settings are percentages or ratios.
  42. A max headroom value is intended to cap the required free disk space before hitting
  43. the respective watermark. This is useful for servers with larger disks, where a percentage or ratio watermark could translate to an overly large free disk space requirement. In this case, the max headroom can be used to cap the required free disk space amount.
  44. For example, where `cluster.routing.allocation.disk.watermark.flood_stage` is 95% and `cluster.routing.allocation.disk.watermark.flood_stage.max_headroom` is 100GB, this means that:
  45. * For a smaller disk, e.g., of 100GB, the flood watermark will hit at 95%, meaning at 5GB of free space, since 5GB is smaller than the 100GB max headroom value.
  46. * For a larger disk, e.g., of 100TB, the flood watermark will hit at 100GB of free space. That is because the 95% flood watermark alone would require 5TB of free disk space, but is capped by the max headroom setting to 100GB.
  47. Max headroom settings have their default values only if their respective watermark settings are not explicitly set. If watermarks are explicitly set, then the max headroom settings do not have their default values, and need to be explicitly set if they are needed.
  48. ===================================================
  49. [[disk-based-shard-allocation-does-not-balance]]
  50. [TIP]
  51. ====
  52. It is normal for the nodes in your cluster to be using very different amounts
  53. of disk space. The <<shards-rebalancing-settings,balance>> of the cluster
  54. depends on a combination of factors which includes the number of shards on each
  55. node, the indices to which those shards belong, and the resource needs of each
  56. shard in terms of its size on disk and its CPU usage. {es} must trade off all
  57. of these factors against each other, and a cluster which is balanced when
  58. looking at the combination of all of these factors may not appear to be
  59. balanced if you focus attention on just one of them.
  60. ====
  61. You can use the following settings to control disk-based allocation:
  62. [[cluster-routing-disk-threshold]]
  63. // tag::cluster-routing-disk-threshold-tag[]
  64. `cluster.routing.allocation.disk.threshold_enabled`::
  65. (<<dynamic-cluster-setting,Dynamic>>)
  66. Defaults to `true`. Set to `false` to disable the disk allocation decider. Upon disabling, it will also remove any existing `index.blocks.read_only_allow_delete` index blocks.
  67. // end::cluster-routing-disk-threshold-tag[]
  68. [[cluster-routing-watermark-low]]
  69. // tag::cluster-routing-watermark-low-tag[]
  70. `cluster.routing.allocation.disk.watermark.low` {ess-icon}::
  71. (<<dynamic-cluster-setting,Dynamic>>)
  72. Controls the low watermark for disk usage. It defaults to `85%`, meaning that {es} will not allocate shards to nodes that have more than 85% disk used. It can alternatively be set to a ratio value, e.g., `0.85`. It can also be set to an absolute byte value (like `500mb`) to prevent {es} from allocating shards if less than the specified amount of space is available. This setting has no effect on the primary shards of newly-created indices but will prevent their replicas from being allocated.
  73. // end::cluster-routing-watermark-low-tag[]
  74. `cluster.routing.allocation.disk.watermark.low.max_headroom`::
  75. (<<dynamic-cluster-setting,Dynamic>>) Controls the max headroom for the low watermark (in case of a percentage/ratio value).
  76. Defaults to 200GB when `cluster.routing.allocation.disk.watermark.low` is not explicitly set.
  77. This caps the amount of free space required.
  78. [[cluster-routing-watermark-high]]
  79. // tag::cluster-routing-watermark-high-tag[]
  80. `cluster.routing.allocation.disk.watermark.high` {ess-icon}::
  81. (<<dynamic-cluster-setting,Dynamic>>)
  82. Controls the high watermark. It defaults to `90%`, meaning that {es} will attempt to relocate shards away from a node whose disk usage is above 90%. It can alternatively be set to a ratio value, e.g., `0.9`. It can also be set to an absolute byte value (similarly to the low watermark) to relocate shards away from a node if it has less than the specified amount of free space. This setting affects the allocation of all shards, whether previously allocated or not.
  83. // end::cluster-routing-watermark-high-tag[]
  84. `cluster.routing.allocation.disk.watermark.high.max_headroom`::
  85. (<<dynamic-cluster-setting,Dynamic>>) Controls the max headroom for the high watermark (in case of a percentage/ratio value).
  86. Defaults to 150GB when `cluster.routing.allocation.disk.watermark.high` is not explicitly set.
  87. This caps the amount of free space required.
  88. `cluster.routing.allocation.disk.watermark.enable_for_single_data_node`::
  89. (<<static-cluster-setting,Static>>)
  90. In earlier releases, the default behaviour was to disregard disk watermarks for a single
  91. data node cluster when making an allocation decision. This is deprecated behavior
  92. since 7.14 and has been removed in 8.0. The only valid value for this setting
  93. is now `true`. The setting will be removed in a future release.
  94. [[cluster-routing-flood-stage]]
  95. // tag::cluster-routing-flood-stage-tag[]
  96. `cluster.routing.allocation.disk.watermark.flood_stage` {ess-icon}::
  97. +
  98. --
  99. (<<dynamic-cluster-setting,Dynamic>>)
  100. Controls the flood stage watermark, which defaults to 95%. {es} enforces a read-only index block (<<index-block-settings,`index.blocks.read_only_allow_delete`>>) on every index that has one or more shards allocated on the node, and that has at least one disk exceeding the flood stage. This setting is a last resort to prevent nodes from running out of disk space. The index block is automatically released when the disk utilization falls below the high watermark. Similarly to the low and high watermark values, it can alternatively be set to a ratio value, e.g., `0.95`, or an absolute byte value.
  101. --
  102. // end::cluster-routing-flood-stage-tag[]
  103. `cluster.routing.allocation.disk.watermark.flood_stage.max_headroom`::
  104. (<<dynamic-cluster-setting,Dynamic>>) Controls the max headroom for the flood stage watermark (in case of a percentage/ratio value).
  105. Defaults to 100GB when
  106. `cluster.routing.allocation.disk.watermark.flood_stage` is not explicitly set.
  107. This caps the amount of free space required.
  108. NOTE: You can't mix the usage of percentage/ratio values and byte values across
  109. the `cluster.routing.allocation.disk.watermark.low`, `cluster.routing.allocation.disk.watermark.high`,
  110. and `cluster.routing.allocation.disk.watermark.flood_stage` settings. Either all values
  111. must be set to percentage/ratio values, or all must be set to byte values. This is required
  112. so that {es} can validate that the settings are internally consistent, ensuring that the
  113. low disk threshold is less than the high disk threshold, and the high disk threshold is
  114. less than the flood stage threshold. A similar comparison check is done for the max
  115. headroom values.
  116. [[cluster-routing-flood-stage-frozen]]
  117. // tag::cluster-routing-flood-stage-tag[]
  118. `cluster.routing.allocation.disk.watermark.flood_stage.frozen` {ess-icon}::
  119. (<<dynamic-cluster-setting,Dynamic>>)
  120. Controls the flood stage watermark for dedicated frozen nodes, which defaults to
  121. 95%.
  122. `cluster.routing.allocation.disk.watermark.flood_stage.frozen.max_headroom` {ess-icon}::
  123. (<<dynamic-cluster-setting,Dynamic>>)
  124. Controls the max headroom for the flood stage watermark (in case of a
  125. percentage/ratio value) for dedicated frozen nodes. Defaults to 20GB when
  126. `cluster.routing.allocation.disk.watermark.flood_stage.frozen` is not explicitly
  127. set. This caps the amount of free space required on dedicated frozen nodes.
  128. `cluster.info.update.interval`::
  129. (<<dynamic-cluster-setting,Dynamic>>)
  130. How often {es} should check on disk usage for each node in the
  131. cluster. Defaults to `30s`.
  132. NOTE: Percentage values refer to used disk space, while byte values refer to
  133. free disk space. This can be confusing, because it flips the meaning of high and
  134. low. For example, it makes sense to set the low watermark to 10gb and the high
  135. watermark to 5gb, but not the other way around.