发布于 2015-09-14 14:48:21 | 164 次阅读 | 评论: 0 | 来源: 网络整理
In a sharded cluster, the balancer process is responsible for distributing sharded data around the cluster, so that each shard has roughly the same amount of data.
However, when creating backups from a sharded cluster it’s important that you disable the balancer while taking backups to ensure that no chunk migrations affect the content of the backup captured by the backup procedure. Using the procedure outlined in the section Disable the Balancer you can stop the balancer process temporarily using a manual process. As an alternative you can use this procedure to define a balancing window so that the balancer is always during your automated backup operation.
If you have an automated backup schedule, you can disable all balancing operations for a period of time. For instance, consider the following command:
use config
db.settings.update( { _id : "balancer" }, { $set : { activeWindow : { start : "6:00", stop : "23:00" } } }, true )
This operation configures the balancer to run between 6:00 am and 11:00pm, server time. Schedule your backup operation to run and complete in this time. Ensure that the backup can complete during the window when the balancer is running and that the balancer can effectively balance the collection among the shards in the window allotted to each.