For development reasons, I need to backup a production replica set mongodb and restore it on a stand alone, different machine test instance.
Some docs are talking about the opposite ( standalone 2 replica-set ), but I cannot find his downgrade/rollback way.
What's the way to go, in this case ?
No matter how many nodes you have in a replica set, each of them holds the same data.
So getting the data is easy - just use mongodump
(preferably against the secondary, for performance reasons) and then mongorestore
into a new mongod for your development stand-alone system.
mongodump
does not pick up any replication related collections (they live in database called local
). If you end up taking a file system snapshot of a replica node rather than using mongodump
, be sure to drop the local
database when you restore the snapshot into your production stand-alone server and then restart mongod
so that it will properly detect that it is not part of a replica set.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.