disk_allocator.asciidoc 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.
  37. [[disk-based-shard-allocation-does-not-balance]]
  38. [TIP]
  39. ====
  40. It is normal for the nodes in your cluster to be using very different amounts
  41. of disk space. The <<shards-rebalancing-settings,balance>> of the cluster
  42. depends only on the number of shards on each node and the indices to which
  43. those shards belong. It considers neither the sizes of these shards nor the
  44. available disk space on each node, for the following reasons:
  45. * Disk usage changes over time. Balancing the disk usage of individual nodes
  46. would require a lot more shard movements, perhaps even wastefully undoing
  47. earlier movements. Moving a shard consumes resources such as I/O and network
  48. bandwidth and may evict data from the filesystem cache. These resources are
  49. better spent handling your searches and indexing where possible.
  50. * A cluster with equal disk usage on every node typically performs no better
  51. than one that has unequal disk usage, as long as no disk is too full.
  52. ====
  53. You can use the following settings to control disk-based allocation:
  54. [[cluster-routing-disk-threshold]]
  55. // tag::cluster-routing-disk-threshold-tag[]
  56. `cluster.routing.allocation.disk.threshold_enabled` {ess-icon}::
  57. (<<dynamic-cluster-setting,Dynamic>>)
  58. Defaults to `true`. Set to `false` to disable the disk allocation decider.
  59. // end::cluster-routing-disk-threshold-tag[]
  60. [[cluster-routing-watermark-low]]
  61. // tag::cluster-routing-watermark-low-tag[]
  62. `cluster.routing.allocation.disk.watermark.low` {ess-icon}::
  63. (<<dynamic-cluster-setting,Dynamic>>)
  64. 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 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.
  65. // end::cluster-routing-watermark-low-tag[]
  66. [[cluster-routing-watermark-high]]
  67. // tag::cluster-routing-watermark-high-tag[]
  68. `cluster.routing.allocation.disk.watermark.high` {ess-icon}::
  69. (<<dynamic-cluster-setting,Dynamic>>)
  70. 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 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.
  71. // end::cluster-routing-watermark-high-tag[]
  72. `cluster.routing.allocation.disk.watermark.enable_for_single_data_node`::
  73. (<<static-cluster-setting,Static>>)
  74. In earlier releases, the default behaviour was to disregard disk watermarks for a single
  75. data node cluster when making an allocation decision. This is deprecated behavior
  76. since 7.14 and has been removed in 8.0. The only valid value for this setting
  77. is now `true`. The setting will be removed in a future release.
  78. [[cluster-routing-flood-stage]]
  79. // tag::cluster-routing-flood-stage-tag[]
  80. `cluster.routing.allocation.disk.watermark.flood_stage` {ess-icon}::
  81. +
  82. --
  83. (<<dynamic-cluster-setting,Dynamic>>)
  84. Controls the flood stage watermark, which defaults to 95%. {es} enforces a read-only index block (`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.
  85. NOTE: You cannot mix the usage of percentage values and byte values within
  86. these settings. Either all values are set to percentage values, or all are set to byte values. This enforcement is so that {es} can validate that the settings are internally consistent, ensuring that the low disk threshold is less than the high disk threshold, and the high disk threshold is less than the flood stage threshold.
  87. An example of resetting the read-only index block on the `my-index-000001` index:
  88. [source,console]
  89. --------------------------------------------------
  90. PUT /my-index-000001/_settings
  91. {
  92. "index.blocks.read_only_allow_delete": null
  93. }
  94. --------------------------------------------------
  95. // TEST[setup:my_index]
  96. --
  97. // end::cluster-routing-flood-stage-tag[]
  98. [[cluster-routing-flood-stage-frozen]]
  99. // tag::cluster-routing-flood-stage-tag[]
  100. `cluster.routing.allocation.disk.watermark.flood_stage.frozen` {ess-icon}::
  101. (<<dynamic-cluster-setting,Dynamic>>)
  102. Controls the flood stage watermark for dedicated frozen nodes, which defaults to
  103. 95%.
  104. `cluster.routing.allocation.disk.watermark.flood_stage.frozen.max_headroom` {ess-icon}::
  105. (<<dynamic-cluster-setting,Dynamic>>)
  106. Controls the max headroom for the flood stage watermark for dedicated frozen
  107. nodes. Defaults to 20GB when
  108. `cluster.routing.allocation.disk.watermark.flood_stage.frozen` is not explicitly
  109. set. This caps the amount of free space required on dedicated frozen nodes.
  110. `cluster.info.update.interval`::
  111. (<<dynamic-cluster-setting,Dynamic>>)
  112. How often {es} should check on disk usage for each node in the
  113. cluster. Defaults to `30s`.
  114. NOTE: Percentage values refer to used disk space, while byte values refer to
  115. free disk space. This can be confusing, since it flips the meaning of high and
  116. low. For example, it makes sense to set the low watermark to 10gb and the high
  117. watermark to 5gb, but not the other way around.
  118. An example of updating the low watermark to at least 100 gigabytes free, a high
  119. watermark of at least 50 gigabytes free, and a flood stage watermark of 10
  120. gigabytes free, and updating the information about the cluster every minute:
  121. [source,console]
  122. --------------------------------------------------
  123. PUT _cluster/settings
  124. {
  125. "transient": {
  126. "cluster.routing.allocation.disk.watermark.low": "100gb",
  127. "cluster.routing.allocation.disk.watermark.high": "50gb",
  128. "cluster.routing.allocation.disk.watermark.flood_stage": "10gb",
  129. "cluster.info.update.interval": "1m"
  130. }
  131. }
  132. --------------------------------------------------