and I think by doing this SECONDARIES did not perform full initial sync (removing contents of dbPath and then downloading all data from primary) but only replicated changes that happened on PRIMARY but were not present on SECONDARY (I assume it was done based on last oplog operation in SECONDARY and PRIMARY).
I am wondering if those steps I outlined are correct (or maybe this process can be made even simpler) because section https://docs.mongodb.com/manual/tutorial/backup-with-filesystem-snapshots/#backup-and-restore-with-filesystem-snapshots does not say anything about actually restoring the data and next page https://docs.mongodb.com/manual/tutorial/restore-replica-set-from-backup/ instruct us to invoke rs.initiate() but it is not possible after performing LVM snapshot because local database is still present so the member is already part of old replica set.
Basically I would like to know
Hi Andrzej,
I am wondering if those steps I outlined are correct (or maybe this process can be made even simpler) because section https://docs.mongodb.com/manual/tutorial/backup-with-filesystem-snapshots/#backup-and-restore-with-filesystem-snapshots does not say anything about actually restoring the data and next page https://docs.mongodb.com/manual/tutorial/restore-replica-set-from-backup/ instruct us to invoke rs.initiate() but it is not possible after performing LVM snapshot because local database is still present so the member is already part of old replica set.
Please note that the steps you outlined is not a supported nor tested method of restoring a replica set from filesystem snapshots. Specifically, the method outlined in the Backup and Restore with Filesystem Snapshots concerns a standalone deployment, and the page Restore a Replica Set from MongoDB Backups uses initial sync in the procedure.
I believe the page you are looking for is Sync by Copying Data Files from Another Member, where it describes a situation where you need to “seed” a member of a replica set.
Basically I would like to know
- can I just drop local database from LVM snapshot data
As mentioned in the page Sync by Copying Data Files from Another Member, the local database must exist.
- when dbPath cleanup with full initial sync is performed and when mongod assumes that the data in dbPath is “good-enough” for the seed and only replicates missing data from the primary (after adding the SECONDARY with rs.add() on PRIMARY)
In general, initial sync is performed when a node has no data, or when the member has data but is missing a history of the set’s replication (e.g. a missing local database). Please see the Initial Sync page for more details.
Best regards,
Kevin