Reputation: 12689
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 ?
Upvotes: 2
Views: 2242
Reputation: 42352
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.
Upvotes: 4