Updated on 2024-03-27 GMT+08:00
How Do I Disable the Balancer?
Before using the DRS service to migrate collections between sharded clusters, you must disable the balancer of the collections to be migrated.
- You can disable the DDS cluster balancer by calling an API. For details, see Enabling or Disabling Cluster Balancing or contact DDS technical support. For a self-built MongoDB database, refer to the following steps.
- After the migration is complete, enable the balancer. The balancer is disabled during the migration, generating different numbers of chunks on each shard of the source database. After the balancer is enabled, chunks will be distributed between shards in the cluster, which may affect the performance of the source database.
Procedure
- Log in to a database through mongo shell.
- Run the following command in the command window of the mongos node to switch to the config database:
use config
- Run the following commands to check whether the balancer can be disabled:
while( sh.isBalancerRunning() ) { print("waiting..."); sleep(1000); }
- If the command output is waiting, the balancer is migrating chunks. In this case, do not disable the balancer. Otherwise, data inconsistency may occur.
Figure 1 Viewing the command output
- If no command output is displayed, the balancer is not migrating any chunks. In this case, you can disable the balancer:
- If the command output is waiting, the balancer is migrating chunks. In this case, do not disable the balancer. Otherwise, data inconsistency may occur.
- Disable the balancer.
- If you migrate the entire DB instance, run the following command to disable the balancer.
sh.stopBalancer()
- If you need to disable the balancer of the sharded collections to be migrated, run the following command:
sh.disableBalancing("database.collection")
database.collection indicates the namespace of the collection to be migrated.
- If you migrate the entire DB instance, run the following command to disable the balancer.
Parent topic: Real-Time Migration
Real-Time Migration FAQs
- When Can I Stop a Migration Task?
- How Do I Maintain the Original Service User Permission System After Definer Is Forcibly Converted During MySQL Migration?
- What Can I Do If the Invoking Permission Problem Occurs After the MySQL Stored Procedure Is Migrated to the Cloud?
- How Do I Ensure that All Services on the Database Are Stopped?
- What Can I Do When Message "can not get agency token" Is Displayed in the Migration Log
- What Do I Do If the Maximum Index Length Has Been Reached During Migration from Oracle to MySQL?
- Why Is the Collation of Heterogeneous or Oracle Databases Converted to utf8mb4_bin After Those Databases Are Migrated to MySQL?
- What Can I Do If MyISAM Tables Are Not Supported by RDS for MySQL?
- What Are the Precautions for Migrating Data from an Earlier Version MySQL to MySQL 8.0?
- What Can I Do When OOM Occurs During the Migration of MongoDB Databases?
- How Do I Disable the Balancer?
- How Do I Export and Import Events and Triggers in Batches?
- How Can I Migrate Databases or Tables Whose Names Contain Uppercase Letters?
- How Do I Delete Orphaned Documents in MongoDB Sharded Clusters?
- What Can I Do If There Is an Extra Backslash (\) After a MySQL Account Is Migrated?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbotmore