Does mongodump lock the database?

后端 未结 2 1869
孤独总比滥情好
孤独总比滥情好 2021-02-07 16:39

I\'m in the middle of setting up a backup strategy for mongo, was just curious to know if mongodump locks the database before performing the database dump?

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 17:18

    Mongdump does not lock the db. It means other read and write operations will continue normally.

    Actually, both mongodump and mongorestore are non-blocking. So if you want to mongodump mongorestore a db then its your responsibility to make sure that it is really a desired snapshot backup/restore. To do this, you must stop all other write operations while taking/restoring backups with mongodump/mongorestore. If you are running a sharded environment then its recommended you stop the balancer also.

提交回复
热议问题