MongoDB initialization data synchronization

MongoDB initialization data synchronization: after a member of the replica set to start, will check their status, to determine whether a member can be synchronized from there. If not, try a complete copy of the data from the other members there. This process is the initial synchronization (initial syncing), these steps can be viewed from mongod log.

1, first of all, the members will do some preparatory work before recording: select a member as a synchronization source, create an identifier for yourself in local.me, delete all existing database, be reproduced in a new state. In this process, all existing data will be deleted. You should only do the initial synchronization without the need to retain the existing data, because mongod will first delete the existing data.

2, then the clone (Cloning), is that all records will be synchronized to the local copy all source. It is usually the most time-consuming.

3, then proceeds to Step oplogt synchronization, the cloning process all operations are recorded in the oplog. If there is a document to be moved during the cloning process, and it may be missed, resulting in not being cloned, for such a document you might need to re-clone

4, followed by the second step oplog synchronization process, the first synchronization operation oplogt recorded for

5, so far, local data should be fully consistent with the data some point in time the master node, you can create an index, if the collection is relatively large, to create the index will be more time-consuming

6, if the current node's data is still far behind the synchronization source, then the last step oplog synchronization process is to create an index of all operations during the record all to prevent that member becomes the backup node

7, now, the current members of the initialization is complete, switch to normal synchronous state, then you can become a member of the current backup node replset initial sync done replset syncing replset secondary

Guess you like

Origin www.cnblogs.com/hankyoon/p/11693986.html