Saturday, January 27, 2018
SolrCloud - suggestions for leaders rebalancing
This is a useful and simple bash script that helps rebalancing the cluster leaders, in case of having more than one leader of the same collection, hosted on the same node.
Hosting more than 1 leader of the same collection on the same node (2 different shards leaders) is not a good practice, as it is not helping distributing the writes load for the collection.
The script would suggest the next action -> move from node A to B, the leader of shard X, of collection Y. What it actually means is -> add node B to shard X, and remove node A from shard X of collection Y. It would ask you to re-run the script afterwards, and get the next required actions, based on the new solr cluster status.
If it doesn't find any collection that has more than 1 leader hosted on the same node, it won't suggest anything.
In Solr 7, new rules for cluster auto scaling and management were added, and it is worth checking them as well.
The script contains many useful commands for playing and parsing the "clusterstatus" output.
You might add suggestion for general rebalancing of the cluster, in case of, for instance, too many leaders that are hosted on few nodes, while other nodes are not hosting any leader.
It only requires JQ installed on the running machine.
example for execution: ./solr-suggest.sh "https://solr-node01"