allocation.asciidoc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. [[cat-allocation]]
  2. === cat allocation API
  3. ++++
  4. <titleabbrev>cat allocation</titleabbrev>
  5. ++++
  6. ..New API reference
  7. [sidebar]
  8. --
  9. For the most up-to-date API details, refer to {api-es}/group/endpoint-cat[Compact and aligned text (CAT) APIs]..
  10. --
  11. [IMPORTANT]
  12. ====
  13. cat APIs are only intended for human consumption using the command line or {kib}
  14. console. They are _not_ intended for use by applications.
  15. ====
  16. Provides a snapshot of the number of shards allocated to each data node
  17. and their disk space.
  18. [[cat-allocation-api-request]]
  19. ==== {api-request-title}
  20. `GET /_cat/allocation/<node_id>`
  21. `GET /_cat/allocation`
  22. [[cat-allocation-api-prereqs]]
  23. ==== {api-prereq-title}
  24. * If the {es} {security-features} are enabled, you must have the `monitor` or
  25. `manage` <<privileges-list-cluster,cluster privilege>> to use this API.
  26. [[cat-allocation-api-path-params]]
  27. ==== {api-path-parms-title}
  28. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=node-id]
  29. [[cat-allocation-api-query-params]]
  30. ==== {api-query-parms-title}
  31. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=bytes]
  32. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  33. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=local]
  34. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  35. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  36. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=help]
  37. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  38. include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  39. [[cat-allocation-api-response-body]]
  40. ==== {api-response-body-title}
  41. `shards`::
  42. Number of primary and replica shards assigned to the node.
  43. `shards.undesired`::
  44. Amount of shards that are scheduled to be moved elsewhere in the cluster
  45. or -1 other than desired balance allocator is used
  46. `write_load.forecast`::
  47. Sum of index write load forecasts
  48. `disk.indices.forecast`::
  49. Sum of shard size forecasts
  50. `disk.indices`::
  51. Disk space used by the node's shards. Does not include disk space for the
  52. <<index-modules-translog,translog>> or unassigned shards.
  53. +
  54. IMPORTANT: This metric double-counts disk space for hard-linked files, such as
  55. those created when <<indices-shrink-index,shrinking>>,
  56. <<indices-split-index,splitting>>, or <<indices-clone-index,cloning>> an index.
  57. `disk.used`::
  58. +
  59. --
  60. Total disk space in use. {es} retrieves this metric from the node's operating
  61. system (OS). The metric includes disk space for:
  62. - {es}, including the <<index-modules-translog,translog>> and unassigned shards
  63. - The node's OS
  64. - Any other applications or files on the node
  65. Unlike `disk.indices`, this metric does not double-count disk space for
  66. hard-linked files.
  67. --
  68. `disk.avail`::
  69. Free disk space available to {es}. {es} retrieves this metric from the node's
  70. OS. <<disk-based-shard-allocation,Disk-based shard allocation>> uses this metric to assign
  71. shards to nodes based on available disk space.
  72. `disk.total`::
  73. Total disk space for the node, including in-use and available space.
  74. `disk.percent`::
  75. Total percentage of disk space in use. Calculated as `disk.used` / `disk.total`.
  76. `host`::
  77. Network host for the node. Set using <<network.host,`network.host`>>.
  78. `ip`::
  79. IP address and port for the node.
  80. `node`::
  81. Name for the node. Set using <<node-name,`node.name`>>.
  82. `node.role`, `r`, `role`, `nodeRole`::
  83. Node roles
  84. [[cat-allocation-api-example]]
  85. ==== {api-examples-title}
  86. [source,console,id=cat-allocation-example]
  87. --------------------------------------------------
  88. GET /_cat/allocation?v=true
  89. --------------------------------------------------
  90. // TEST[s/^/PUT test\n{"settings": {"number_of_replicas": 0}}\n/]
  91. The API returns the following response:
  92. [source,txt]
  93. --------------------------------------------------
  94. shards shards.undesired write_load.forecast disk.indices.forecast disk.indices disk.used disk.avail disk.total disk.percent host ip node node.role
  95. 1 0 0.0 260b 260b 47.3gb 43.4gb 100.7gb 46 127.0.0.1 127.0.0.1 CSUXak2 himrst
  96. --------------------------------------------------
  97. // TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/ s/46/\\d+/]
  98. // TESTRESPONSE[s/CSUXak2 himrst/.+/ non_json]
  99. This response shows a single shard is allocated to the one node available.