datto / es-disk-rebalance

MIT License
4 stars 3 forks source link

tool doesn't work #3

Open ynuyasha opened 2 years ago

ynuyasha commented 2 years ago

Hi guys, i tried to install with pip3 install es-disk-rebalance/ and then execute your tool with command es-rebalance -v -u 'https://user:pwd@localhost:9200' --box-type hot --iterations 50

but tool crash with this error: INFO:elasticsearch:GET https://localhost:9200/_cat/allocation?bytes=b&format=json [status:200 request:0.311s] INFO:elasticsearch:GET https://localhost:9200/_cat/shards?bytes=b&format=json [status:200 request:0.854s] INFO:elasticsearch:GET https://localhost:9200/_nodes?format=json [status:200 request:0.016s] Traceback (most recent call last): File "/usr/local/bin/es-rebalance", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/es_rebalance/__main__.py", line 57, in main if not plan.plan_step(): File "/usr/local/lib/python3.6/dist-packages/es_rebalance/rebalance.py", line 177, in plan_step current_pvariance = self.percent_used_variance() File "/usr/local/lib/python3.6/dist-packages/es_rebalance/rebalance.py", line 365, in percent_used_variance return statistics.pvariance(percentage(node) for node in self.nodes_by_size) File "/usr/lib/python3.6/statistics.py", line 636, in pvariance raise StatisticsError('pvariance requires at least one data point') statistics.StatisticsError: pvariance requires at least one data point

i have also modified connection to es = Elasticsearch(args.url,verify_certs=False) to connect to an https endpoint with a self signed certificate I'm trying to use this tool with Opensearch 1.2 Can you help me here please?

ynuyasha commented 2 years ago

Hi @mhoydis, can you help me here? i found you in https://forum.opensearch.org/t/brainstorm-saving-state-for-shards-allocator/8783/3 discussion I'll try to use your script with an opensearch cluster. Actually i have found two limits that i have tried to bypass:

  1. https://github.com/datto/es-disk-rebalance/blob/master/es_rebalance/rebalance.py#L118 in Opensearch this info doesn't exists by default and you assume it
  2. https://github.com/datto/es-disk-rebalance/blob/master/es_rebalance/rebalance.py#L123 Here the same, rack doesn't have a default value so script fail

Anyway after tried to fix 2 points above, script start but it never finish with a suggestion to move a shard but always with this:

INFO:elasticsearch:GET https://x.x.x.x:9200/_nodes?format=json [status:200 request:0.246s]

WARNING:es_rebalance.rebalance:Won't be able to move shard {'index': 'log-2022.04.26', 'shard': '4', 'prirep': 'p', 'state': 'RELOCATING', 'docs': '173967', 'store': '1840437613', 'ip': 'x.x.x.x', 'node': 'data7 -> 172.30.11.23 daELv3QnTj-Z7c37-VZq9g data3'} on host ('data7', 'data3'), state is RELOCATING

WARNING:es_rebalance.rebalance:Won't be able to move shard {'index': 'index_2', 'shard': '0', 'prirep': 'r', 'state': 'RELOCATING', 'docs': '21405464', 'store': '17854658578', 'ip': 'x.x.x.x', 'node': 'data5 -> x.x.x.x LlcyV-eQT1WHG5WPN4LgOQ data6'} on host ('data5', 'data6'), state is RELOCATING

WARNING:__main__:Could not move anything, stopping early after 1 iteration(s)

INFO:elasticsearch:POST https://x.x.x.x:9200/_cluster/reroute?dry_run=true [status:200 request:2.304s]

WARNING:__main__:Finished dry run. Use `--execute` to run for real.