ANNOUNCEMENT: Voyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas.
Learn more
Docs 菜单

安排自管理分片集群的备份窗口

在此页面上

In a 分片集群, the balancer process is responsible for distributing sharded data around the cluster, so that each 分片 has roughly the same amount of data.

However, when creating backups from a sharded cluster it is 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.

注意

仅当手动进行备份时才需禁用负载均衡器,具体方法是调用 mongodump 或安排会在特定时间调用 mongodump 的任务。

使用协调式备份与恢复流程时,不必禁用负载均衡器:

Using the procedure outlined in the section 禁用负载均衡器 you can manually stop the balancer process temporarily. As an alternative, you can use the following procedure to define a balancing window so that the balancer is always disabled during your automated backup operation.

提示

要使用 mongodump mongorestore 作为分片集群的备份策略,请参阅使用数据库转储备份自管理分片集群。

分片集群还可以使用以下协调备份和恢复流程之一,以确保跨分片事务的原子性:

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.updateOne(
{ _id : "balancer" },
{ $set : { activeWindow : { start : "06:00", stop : "23:00" } } },
true
)

This operation configures the balancer to run between 6:00am and 11:00pm, server time. Schedule your backup operation to run and complete outside of this time. Ensure that the backup can complete outside 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.

在此页面上