total-shards-per-node.asciidoc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. //////////////////////////
  2. [source,console]
  3. --------------------------------------------------
  4. PUT my-index-000001
  5. {
  6. "settings": {
  7. "index.routing.allocation.total_shards_per_node": "1"
  8. }
  9. }
  10. --------------------------------------------------
  11. // TESTSETUP
  12. [source,console]
  13. --------------------------------------------------
  14. DELETE my-index-000001
  15. --------------------------------------------------
  16. // TEARDOWN
  17. //////////////////////////
  18. // tag::cloud[]
  19. In order to get the shards assigned we'll need to increase the number of shards
  20. that can be collocated on a node.
  21. We'll achieve this by inspecting the configuration for the `index.routing.allocation.total_shards_per_node`
  22. <<indices-get-settings, index setting>> and increasing the configured value for the
  23. indices that have shards unassigned.
  24. **Use {kib}**
  25. //tag::kibana-api-ex[]
  26. . Log in to the {ess-console}[{ecloud} console].
  27. +
  28. . On the **Elasticsearch Service** panel, click the name of your deployment.
  29. +
  30. NOTE:
  31. If the name of your deployment is disabled your {kib} instances might be
  32. unhealthy, in which case please contact https://support.elastic.co[Elastic Support],
  33. or your deployment doesn't include {kib}, in which case all you need to do is
  34. {cloud}/ec-access-kibana.html[enable Kibana first].
  35. . Open your deployment's side navigation menu (placed under the Elastic logo in the upper left corner)
  36. and go to **Dev Tools > Console**.
  37. +
  38. [role="screenshot"]
  39. image::images/kibana-console.png[{kib} Console,align="center"]
  40. . Inspect the `index.routing.allocation.total_shards_per_node` <<indices-get-settings, index setting>>
  41. for the index with unassigned shards:
  42. +
  43. [source,console]
  44. ----
  45. GET /my-index-000001/_settings/index.routing.allocation.total_shards_per_node?flat_settings
  46. ----
  47. +
  48. The response will look like this:
  49. +
  50. [source,console-result]
  51. ----
  52. {
  53. "my-index-000001": {
  54. "settings": {
  55. "index.routing.allocation.total_shards_per_node": "1" <1>
  56. }
  57. }
  58. }
  59. ----
  60. +
  61. <1> Represents the current configured value for the total number of shards
  62. that can reside on one node for the `my-index-000001` index.
  63. . <<indices-update-settings,Increase>> the value for the total number of shards
  64. that can be assigned on one node to a higher value:
  65. +
  66. [source,console]
  67. ----
  68. PUT /my-index-000001/_settings
  69. {
  70. "index" : {
  71. "routing.allocation.total_shards_per_node" : "2" <1>
  72. }
  73. }
  74. ----
  75. // TEST[continued]
  76. +
  77. <1> The new value for the `total_shards_per_node` configuration for the `my-index-000001` index
  78. is increased from the previous value of `1` to `2`.
  79. The `total_shards_per_node` configuration can also be set to `-1`, which
  80. represents no upper bound with regards to how many shards of the same
  81. index can reside on one node.
  82. //end::kibana-api-ex[]
  83. // end::cloud[]
  84. // tag::self-managed[]
  85. In order to get the shards assigned you can add more nodes to your {es} cluster
  86. and assing the index's target tier <<assign-data-tier, node role>> to the new
  87. nodes.
  88. To inspect which tier is an index targeting for assignment, use the <<indices-get-settings, get index setting>>
  89. API to retrieve the configured value for the `index.routing.allocation.include._tier_preference`
  90. setting:
  91. [source,console]
  92. ----
  93. GET /my-index-000001/_settings/index.routing.allocation.include._tier_preference?flat_settings
  94. ----
  95. // TEST[continued]
  96. The reponse will look like this:
  97. [source,console-result]
  98. ----
  99. {
  100. "my-index-000001": {
  101. "settings": {
  102. "index.routing.allocation.include._tier_preference": "data_warm,data_hot" <1>
  103. }
  104. }
  105. }
  106. ----
  107. // TESTRESPONSE[skip:the result is for illustrating purposes only]
  108. <1> Represents a comma separated list of data tier node roles this index is allowed
  109. to be allocated on, the first one in the list being the one with the higher priority
  110. i.e. the tier the index is targeting.
  111. e.g. in this example the tier preference is `data_warm,data_hot` so the index is
  112. targeting the `warm` tier and more nodes with the `data_warm` role are needed in
  113. the {es} cluster.
  114. Alternatively, if adding more nodes to the {es} cluster is not desired,
  115. inspecting the configuration for the `index.routing.allocation.total_shards_per_node`
  116. <<indices-get-settings, index setting>> and increasing the configured value will
  117. allow more shards to be assigned on the same node.
  118. . Inspect the `index.routing.allocation.total_shards_per_node` <<indices-get-settings, index setting>>
  119. for the index with unassigned shards:
  120. +
  121. [source,console]
  122. ----
  123. GET /my-index-000001/_settings/index.routing.allocation.total_shards_per_node?flat_settings
  124. ----
  125. +
  126. The response will look like this:
  127. +
  128. [source,console-result]
  129. ----
  130. {
  131. "my-index-000001": {
  132. "settings": {
  133. "index.routing.allocation.total_shards_per_node": "1" <1>
  134. }
  135. }
  136. }
  137. ----
  138. +
  139. <1> Represents the current configured value for the total number of shards
  140. that can reside on one node for the `my-index-000001` index.
  141. . <<indices-update-settings,Increase>> the total number of shards that can be assigned on one node or
  142. reset the value to unbounded (`-1`):
  143. +
  144. [source,console]
  145. ----
  146. PUT /my-index-000001/_settings
  147. {
  148. "index" : {
  149. "routing.allocation.total_shards_per_node" : -1
  150. }
  151. }
  152. ----
  153. // TEST[continued]
  154. // end::self-managed[]