在使用 mongodump 创建转储之前,是否有必要在 MongoDB 中执行 fsyncLock?
Is it necessary to perform an fsyncLock in MongoDB before creating a dump with mongodump?
在2.6 docs中明确指出当运行时不应使用db.fsyncLock()
mongodump
:
Do not use mongodump with db.fsyncLock().
但此信息自 3.0 version of the docs 后就消失了。在 3.0.
的 mongodump
文档中实际上根本没有关于锁的信息
我的猜测是,使用 --oplog
时没有必要调用 db.fsyncLock()
,但我不是 100% 确定:
Without --oplog, if there are write operations during the dump
operation, the dump will not reflect a single moment in time. Changes
made to the database during the update process can affect the output
of the backup.
你能帮我吗?在使用 mongodump 创建转储之前,是否有必要在 MongoDB 中执行 fsyncLock?
谢谢!
My guess is that, when using --oplog it is not necessary to call db.fsyncLock()
以前使用 MongoDB 3.0 之前的版本,您 不能 在执行 mongodump
时调用 db.fsyncLock()
,现在不需要它.关于不将 fsync
与 mongodump
was removed at several places at once 一起使用的警告,因此它看起来不像是疏忽而是故意更改。
db.fsyncLock()
文档指出
This function locks the database and creates a window for backup operations.
但这只是必要的,因为 Backup with cp or rsync. The Back Up and Restore with MongoDB Tools Tutorial 没有提到任何额外的锁,并且明确提到使用 --oplog
参数,您将获得一致的备份:
Use the --oplog
option with mongodump to collect the oplog entries to build a point-in-time snapshot of a database within a replica set. With --oplog, mongodump copies all the data from the source database as well as all of the oplog entries from the beginning to the end of the backup procedure. This operation, in conjunction with mongorestore --oplogReplay, allows you to restore a backup that reflects the specific moment in time that corresponds to when mongodump completed creating the dump file.
结论:不,你不需要调用db.fsyncLock()
。
在2.6 docs中明确指出当运行时不应使用db.fsyncLock()
mongodump
:
Do not use mongodump with db.fsyncLock().
但此信息自 3.0 version of the docs 后就消失了。在 3.0.
的mongodump
文档中实际上根本没有关于锁的信息
我的猜测是,使用 --oplog
时没有必要调用 db.fsyncLock()
,但我不是 100% 确定:
Without --oplog, if there are write operations during the dump operation, the dump will not reflect a single moment in time. Changes made to the database during the update process can affect the output of the backup.
你能帮我吗?在使用 mongodump 创建转储之前,是否有必要在 MongoDB 中执行 fsyncLock?
谢谢!
My guess is that, when using --oplog it is not necessary to call db.fsyncLock()
以前使用 MongoDB 3.0 之前的版本,您 不能 在执行 mongodump
时调用 db.fsyncLock()
,现在不需要它.关于不将 fsync
与 mongodump
was removed at several places at once 一起使用的警告,因此它看起来不像是疏忽而是故意更改。
db.fsyncLock()
文档指出
This function locks the database and creates a window for backup operations.
但这只是必要的,因为 Backup with cp or rsync. The Back Up and Restore with MongoDB Tools Tutorial 没有提到任何额外的锁,并且明确提到使用 --oplog
参数,您将获得一致的备份:
Use the
--oplog
option with mongodump to collect the oplog entries to build a point-in-time snapshot of a database within a replica set. With --oplog, mongodump copies all the data from the source database as well as all of the oplog entries from the beginning to the end of the backup procedure. This operation, in conjunction with mongorestore --oplogReplay, allows you to restore a backup that reflects the specific moment in time that corresponds to when mongodump completed creating the dump file.
结论:不,你不需要调用db.fsyncLock()
。