allocation.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. [[cat-allocation]]
  2. === cat allocation API
  3. ++++
  4. <titleabbrev>cat allocation</titleabbrev>
  5. ++++
  6. Provides a snapshot of the number of shards allocated to each data node
  7. and their disk space.
  8. [[cat-allocation-api-request]]
  9. ==== {api-request-title}
  10. `GET /_cat/allocation/<node_id>`
  11. `GET /_cat/allocation`
  12. [[cat-allocation-api-prereqs]]
  13. ==== {api-prereq-title}
  14. * If the {es} {security-features} are enabled, you must have the `monitor` or
  15. `manage` <<privileges-list-cluster,cluster privilege>> to use this API.
  16. [[cat-allocation-api-path-params]]
  17. ==== {api-path-parms-title}
  18. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=node-id]
  19. [[cat-allocation-api-query-params]]
  20. ==== {api-query-parms-title}
  21. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=bytes]
  22. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=http-format]
  23. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=local]
  24. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]
  25. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-h]
  26. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=help]
  27. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-s]
  28. include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]
  29. [[cat-allocation-api-response-body]]
  30. ==== {api-response-body-title}
  31. `shards`::
  32. Number of primary and replica shards assigned to the node.
  33. `disk.indices`::
  34. Disk space used by the node's shards. Does not include disk space for the
  35. <<index-modules-translog,translog>> or unassigned shards.
  36. +
  37. IMPORTANT: This metric double-counts disk space for hard-linked files, such as
  38. those created when <<indices-shrink-index,shrinking>>,
  39. <<indices-split-index,splitting>>, or <<indices-clone-index,cloning>> an index.
  40. `disk.used`::
  41. +
  42. --
  43. Total disk space in use. {es} retrieves this metric from the node's operating
  44. system (OS). The metric includes disk space for:
  45. - {es}, including the <<index-modules-translog,translog>> and unassigned shards
  46. - The node's OS
  47. - Any other applications or files on the node
  48. Unlike `disk.indices`, this metric does not double-count disk space for
  49. hard-linked files.
  50. --
  51. `disk.avail`::
  52. Free disk space available to {es}. {es} retrieves this metric from the node's
  53. OS. <<disk-allocator,Disk-based shard allocation>> uses this metric to assign
  54. shards to nodes based on available disk space.
  55. `disk.total`::
  56. Total disk space for the node, including in-use and available space.
  57. `disk.percent`::
  58. Total percentage of disk space in use. Calculated as `disk.used` / `disk.total`.
  59. `host`::
  60. Network host for the node. Set using <<network.host,`network.host`>>.
  61. `ip`::
  62. IP address and port for the node.
  63. `node`::
  64. Name for the node. Set using <<node-name,`node.name`>>.
  65. [[cat-allocation-api-example]]
  66. ==== {api-examples-title}
  67. [source,console,id=cat-allocation-example]
  68. --------------------------------------------------
  69. GET /_cat/allocation?v=true
  70. --------------------------------------------------
  71. // TEST[s/^/PUT test\n{"settings": {"number_of_replicas": 0}}\n/]
  72. The API returns the following response:
  73. [source,txt]
  74. --------------------------------------------------
  75. shards disk.indices disk.used disk.avail disk.total disk.percent host ip node
  76. 1 260b 47.3gb 43.4gb 100.7gb 46 127.0.0.1 127.0.0.1 CSUXak2
  77. --------------------------------------------------
  78. // TESTRESPONSE[s/\d+(\.\d+)?[tgmk]?b/\\d+(\\.\\d+)?[tgmk]?b/ s/46/\\d+/]
  79. // TESTRESPONSE[s/CSUXak2/.+/ non_json]
  80. This response shows a single shard is allocated to the one node available.