You are viewing an older version of this section. View current production version.
SingleStore Managed Service does not support this command.
Rebalances the partitions for a database.
REBALANCE PARTITIONS ON db_name [FORCE]
db_nameis the name of a SingleStore DB database.
REBALANCE_PARTITIONSrestores redundancy by replicating any partitions with only one instance, and then moving partitions around to ensure balance across all the leaves. Use
RESTORE REDUNDANCYinstead if you want to restore redundancy only, without rebalancing partitions.
FORCEoption causes rebalance to create empty partitions for any partition on the cluster which has neither a master nor replica partition attached. Use this option carefully. If an offline node has the only copy of a partition then running
FORCEwill cause the offline node’s partition to be orphaned. When the offline node comes back online the partition won’t be attached back to the cluster. It will have been replaced with an empty partition by rebalance. For some example cases where
FORCEis useful, see Dealing with Failures.
- To see a list of operations that the
REBALANCEis going to execute, run EXPLAIN REBALANCE PARTITIONS.
- To see the status of a running rebalance command, run SHOW REBALANCE STATUS
- This command must be run on the master aggregator node (see Node Requirements for SingleStore DB Commands ).
REBALANCEis an online operation, meaning that as it runs you can continue to read and write data in the database you are rebalancing. However, since
REBALANCEoften needs to move the location of a master partition to another leaf, write transactions may experience some temporary blocking during the rebalance as this happens.
REBALANCE PARTITIONS ON test; Query OK, 1 row affected (9.80 sec)