disk_allocator.asciidoc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. [[disk-allocator]]
  2. === Disk-based shard allocation
  3. Elasticsearch considers the available disk space on a node before deciding
  4. whether to allocate new shards to that node or to actively relocate shards away
  5. from that node.
  6. Below are the settings that can be configured in the `elasticsearch.yml` config
  7. file or updated dynamically on a live cluster with the
  8. <<cluster-update-settings,cluster-update-settings>> API:
  9. `cluster.routing.allocation.disk.threshold_enabled`::
  10. Defaults to `true`. Set to `false` to disable the disk allocation decider.
  11. `cluster.routing.allocation.disk.watermark.low`::
  12. Controls the low watermark for disk usage. It defaults to `85%`, meaning
  13. that Elasticsearch will not allocate shards to nodes that have more than
  14. 85% disk used. It can also be set to an absolute byte value (like `500mb`)
  15. to prevent Elasticsearch from allocating shards if less than the specified
  16. amount of space is available. This setting has no effect on the primary
  17. shards of newly-created indices but will prevent their replicas from being allocated.
  18. `cluster.routing.allocation.disk.watermark.high`::
  19. Controls the high watermark. It defaults to `90%`, meaning that
  20. Elasticsearch will attempt to relocate shards away from a node whose disk
  21. usage is above 90%. It can also be set to an absolute byte value (similarly
  22. to the low watermark) to relocate shards away from a node if it has less
  23. than the specified amount of free space. This setting affects the
  24. allocation of all shards, whether previously allocated or not.
  25. `cluster.routing.allocation.disk.watermark.flood_stage`::
  26. +
  27. --
  28. Controls the flood stage watermark. It defaults to 95%, meaning that
  29. Elasticsearch enforces a read-only index block
  30. (`index.blocks.read_only_allow_delete`) on every index that has one or more
  31. shards allocated on the node that has at least one disk exceeding the flood
  32. stage. This is a last resort to prevent nodes from running out of disk space.
  33. The index block is automatically released once the disk utilization falls below
  34. the high watermark.
  35. NOTE: You can not mix the usage of percentage values and byte values within
  36. these settings. Either all are set to percentage values, or all are set to byte
  37. values. This is so that we can we validate that the settings are internally
  38. consistent (that is, the low disk threshold is not more than the high disk
  39. threshold, and the high disk threshold is not more than the flood stage
  40. threshold).
  41. An example of resetting the read-only index block on the `twitter` index:
  42. [source,console]
  43. --------------------------------------------------
  44. PUT /twitter/_settings
  45. {
  46. "index.blocks.read_only_allow_delete": null
  47. }
  48. --------------------------------------------------
  49. // TEST[setup:twitter]
  50. --
  51. `cluster.info.update.interval`::
  52. How often Elasticsearch should check on disk usage for each node in the
  53. cluster. Defaults to `30s`.
  54. NOTE: Percentage values refer to used disk space, while byte values refer to
  55. free disk space. This can be confusing, since it flips the meaning of high and
  56. low. For example, it makes sense to set the low watermark to 10gb and the high
  57. watermark to 5gb, but not the other way around.
  58. An example of updating the low watermark to at least 100 gigabytes free, a high
  59. watermark of at least 50 gigabytes free, and a flood stage watermark of 10
  60. gigabytes free, and updating the information about the cluster every minute:
  61. [source,console]
  62. --------------------------------------------------
  63. PUT _cluster/settings
  64. {
  65. "transient": {
  66. "cluster.routing.allocation.disk.watermark.low": "100gb",
  67. "cluster.routing.allocation.disk.watermark.high": "50gb",
  68. "cluster.routing.allocation.disk.watermark.flood_stage": "10gb",
  69. "cluster.info.update.interval": "1m"
  70. }
  71. }
  72. --------------------------------------------------
  73. {es} accounts for the future disk usage of ongoing shard relocations and
  74. recoveries to help prevent these shard movements from breaching a watermark.
  75. This mechanism may double-count some data that has already been relocated onto
  76. a node. For instance, if a relocation of a 100GB shard is 90% complete then
  77. {es} has copied 90GB of data onto the target node. This 90GB consumes disk
  78. space and will be reflected in the node's disk usage statistics. However {es}
  79. also treats the relocation as if it will consume another full 100GB in the
  80. future, even though the shard may really only consume a further 10GB of space.
  81. If the node's disks are close to a watermark then this may temporarily prevent
  82. other shards from moving onto the same node. Eventually the relocation will
  83. complete and then {es} will use the node's true disk usage statistics again.