gpt4 book ai didi

mongodb - mongodump 是否锁定数据库?

转载 作者:IT老高 更新时间:2023-10-28 13:14:42 26 4
gpt4 key购买 nike

我正在为 mongo 设置备份策略,只是想知道 mongodump 在执行数据库转储之前是否会锁定数据库?

最佳答案

我在 mongo's google group 上找到了这个:

Mongodump does a simple query on the live system and does not require a shutdown. Like all queries it requires a read lock while running but doesn't not block any more than normal queries.

If you have a replica set you will probably want to use the --oplog flag to do your backups.

有关详细信息,请参阅文档

另外我发现了这个以前问过的问题

摘自上述问题

Locking and copying files is only an option when you don't have heavy write load.

mongodump can be run against live server. It will create some additional load, so don't do it on peak hours. Also, it is advised to do it on a secondary node (if you don't use replica sets, you should).

There are some complications when you have a DB so large that no single machine can hold it. See this document.

Also, if you have replica set, you take down one of secondaries and copy its files directly. See http://www.mongodb.org/display/DOCS/Backups:

关于mongodb - mongodump 是否锁定数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14825557/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com