I have MongoDB setup like this:
Primary | Server1
-----------+---------
Secondary | Server2
-----------+---------
Arbiter | Server3
-----------+---------
Backup | Server4
I have a backup server for daily backup using mongodump. Now I have to test my backup dump using mongorestore.
The main question is the following: What is the best way to restore the backup?
Q1: I have to follow these steps?
- Stop arbiter & secondary
- Drop database in primary
- Restore backup to primary
- Drop database on secondary
- Restart all the server
Q2: Restore the backup on primary without stopping any of the servers?
Q3. Make secondary as primary and restore the backup to secondary ( previous primary), and make it primary.
Q4: Is there is any way to restore both the server?
Please suggest the best approach to restore MongoDB.
Best Answer
As per MongoDB BOL documented Here MongoDB provides
two options
forrestoring
secondary members of a replica set:1) Manually copy the database files to each data directory.
2) Allow initial sync to distribute data automatically.