get-desired-balance.asciidoc 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. [[get-desired-balance]]
  2. === Get desired balance API
  3. ++++
  4. <titleabbrev>Get desired balance</titleabbrev>
  5. ++++
  6. NOTE: {cloud-only}
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-cluster[Cluster APIs].
  11. --
  12. Exposes:
  13. * the <<shards-rebalancing-heuristics,desired balance>> computation and reconciliation stats
  14. * balancing stats such as distribution of shards, disk and ingest forecasts
  15. across nodes and data tiers (based on the current cluster state)
  16. * routing table with each shard current and desired location
  17. * cluster info with nodes disk usages
  18. [[get-desired-balance-request]]
  19. ==== {api-request-title}
  20. [source,console]
  21. --------------------------------------------------
  22. GET /_internal/desired_balance
  23. --------------------------------------------------
  24. // TEST[skip:Can't reliably test desired balance]
  25. The API returns the following result:
  26. [source,console-result]
  27. --------------------------------------------------
  28. {
  29. "stats": {
  30. "computation_active": false,
  31. "computation_submitted": 5,
  32. "computation_executed": 5,
  33. "computation_converged": 5,
  34. "computation_iterations": 4,
  35. "computation_converged_index": 4,
  36. "computation_time_in_millis": 0,
  37. "reconciliation_time_in_millis": 0
  38. },
  39. "cluster_balance_stats" : {
  40. "shard_count": 37,
  41. "undesired_shard_allocation_count": 0,
  42. "tiers": {
  43. "data_hot" : {
  44. "shard_count" : {
  45. "total" : 7.0,
  46. "min" : 2.0,
  47. "max" : 3.0,
  48. "average" : 2.3333333333333335,
  49. "std_dev" : 0.4714045207910317
  50. },
  51. "undesired_shard_allocation_count" : {
  52. "total" : 0.0,
  53. "min" : 0.0,
  54. "max" : 0.0,
  55. "average" : 0.0,
  56. "std_dev" : 0.0
  57. },
  58. "forecast_write_load" : {
  59. "total" : 21.0,
  60. "min" : 6.0,
  61. "max" : 8.5,
  62. "average" : 7.0,
  63. "std_dev" : 1.0801234497346435
  64. },
  65. "forecast_disk_usage" : {
  66. "total" : 36.0,
  67. "min" : 10.0,
  68. "max" : 16.0,
  69. "average" : 12.0,
  70. "std_dev" : 2.8284271247461903
  71. },
  72. "actual_disk_usage" : {
  73. "total" : 36.0,
  74. "min" : 10.0,
  75. "max" : 16.0,
  76. "average" : 12.0,
  77. "std_dev" : 2.8284271247461903
  78. }
  79. },
  80. "data_warm" : {
  81. "shard_count" : {
  82. "total" : 3.0,
  83. "min" : 1.0,
  84. "max" : 1.0,
  85. "average" : 1.0,
  86. "std_dev" : 0.0
  87. },
  88. "undesired_shard_allocation_count" : {
  89. "total" : 0.0,
  90. "min" : 0.0,
  91. "max" : 0.0,
  92. "average" : 0.0,
  93. "std_dev" : 0.0
  94. },
  95. "forecast_write_load" : {
  96. "total" : 0.0,
  97. "min" : 0.0,
  98. "max" : 0.0,
  99. "average" : 0.0,
  100. "std_dev" : 0.0
  101. },
  102. "forecast_disk_usage" : {
  103. "total" : 42.0,
  104. "min" : 12.0,
  105. "max" : 18.0,
  106. "average" : 14.0,
  107. "std_dev" : 2.8284271247461903
  108. },
  109. "actual_disk_usage" : {
  110. "total" : 42.0,
  111. "min" : 12.0,
  112. "max" : 18.0,
  113. "average" : 14.0,
  114. "std_dev" : 2.8284271247461903
  115. }
  116. }
  117. },
  118. "nodes": {
  119. "node-1": {
  120. "node_id": "UPYt8VwWTt-IADAEbqpLxA",
  121. "roles": ["data_content"],
  122. "shard_count": 10,
  123. "undesired_shard_allocation_count": 0,
  124. "forecast_write_load": 8.5,
  125. "forecast_disk_usage_bytes": 498435,
  126. "actual_disk_usage_bytes": 498435
  127. },
  128. "node-2": {
  129. "node_id": "bgC66tboTIeFQ0VgRGI4Gg",
  130. "roles": ["data_content"],
  131. "shard_count": 15,
  132. "undesired_shard_allocation_count": 0,
  133. "forecast_write_load": 3.25,
  134. "forecast_disk_usage_bytes": 384935,
  135. "actual_disk_usage_bytes": 384935
  136. },
  137. "node-3": {
  138. "node_id": "2x1VTuSOQdeguXPdN73yRw",
  139. "roles": ["data_content"],
  140. "shard_count": 12,
  141. "undesired_shard_allocation_count": 0,
  142. "forecast_write_load": 6.0,
  143. "forecast_disk_usage_bytes": 648766,
  144. "actual_disk_usage_bytes": 648766
  145. }
  146. }
  147. },
  148. "routing_table": {
  149. "test": {
  150. "0": {
  151. "current": [
  152. {
  153. "state": "STARTED",
  154. "primary": true,
  155. "node": "UPYt8VwWTt-IADAEbqpLxA",
  156. "node_is_desired": true,
  157. "relocating_node": null,
  158. "relocating_node_is_desired": null,
  159. "shard_id": 0,
  160. "index": "test",
  161. "forecast_write_load": 8.0,
  162. "forecast_shard_size_in_bytes": 1024,
  163. "tier_preference": ["data_content"]
  164. }
  165. ],
  166. "desired": {
  167. "node_ids": [
  168. "UPYt8VwWTt-IADAEbqpLxA"
  169. ],
  170. "total": 1,
  171. "unassigned": 0,
  172. "ignored": 0
  173. }
  174. },
  175. "1": {
  176. "current": [
  177. {
  178. "state": "STARTED",
  179. "primary": true,
  180. "node": "2x1VTuSOQdeguXPdN73yRw",
  181. "node_is_desired": true,
  182. "relocating_node": null,
  183. "relocating_node_is_desired": false,
  184. "shard_id": 1,
  185. "index": "test",
  186. "forecast_write_load": null,
  187. "forecast_shard_size_in_bytes": null,
  188. "tier_preference": ["data_content"]
  189. }
  190. ],
  191. "desired": {
  192. "node_ids": [
  193. "2x1VTuSOQdeguXPdN73yRw"
  194. ],
  195. "total": 1,
  196. "unassigned": 0,
  197. "ignored": 0
  198. }
  199. }
  200. }
  201. },
  202. "cluster_info" : {
  203. "nodes" : {
  204. "UPYt8VwWTt-IADAEbqpLxA" : {
  205. "node_name" : "node-1",
  206. "least_available" : {
  207. "path" : "/data",
  208. "total_bytes" : 1440713945,
  209. "used_bytes" : 1222486407,
  210. "free_bytes" : 218227538,
  211. "free_disk_percent" : 15.1,
  212. "used_disk_percent" : 84.9
  213. },
  214. "most_available" : {
  215. "path" : "/data",
  216. "total_bytes" : 1440713945,
  217. "used_bytes" : 1222486407,
  218. "free_bytes" : 218227538,
  219. "free_disk_percent" : 15.1,
  220. "used_disk_percent" : 84.9
  221. }
  222. }
  223. },
  224. "shard_sizes" : {
  225. "[test][0][p]_bytes" : 1720826288,
  226. "[test][1][p]_bytes" : 1720826288
  227. },
  228. "shard_data_set_sizes" : {
  229. "[test][0][p]_bytes" : 1720826288,
  230. "[test][1][p]_bytes" : 1720826288
  231. },
  232. "shard_paths" : {
  233. "NodeAndShard[nodeId=UPYt8VwWTt-IADAEbqpLxA, shardId=[test][0]]" : "/data",
  234. "NodeAndShard[nodeId=bgC66tboTIeFQ0VgRGI4Gg, shardId=[test][0]]" : "/data"
  235. },
  236. "reserved_sizes" : []
  237. }
  238. }
  239. --------------------------------------------------
  240. // TEST[skip:Can't reliably test desired balance]