Introduction of MongoDB Sharding Balancer and examples of setting method
Balancer introduction:
When there are multiple shards available and there are enough chunks, mongodb's balancer (balancer) migrates data to other shards.
Specify the balance between 0: 00 a.m. and 4: 00 a.m.:
On the mongos node, use config
> db.settings.update ({_ id: "balancer"}, {$set: {activeWindow: {start: "00:00", stop: "4:00"}, true)
Delete the specified time period:
On the mongos node, use config
> db.settings.update ({_ id: "balancer"}, {$unset: {activeWindow: true})
Disable Balancer:
> sh.stopBalancer ()
Enable Balancer:
> sh.startBalancer ()