[SERVER-38103] sync from special position Created: 13/Nov/18  Updated: 16/Nov/21  Resolved: 20/Nov/18

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Trivial - P5
Reporter: lee mingyu Assignee: Danny Hatcher (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

current status

primary-secondary-arbiter (1:1:1)

1) secondary server fails
2) data size 2TB
3) we cannot initial sync because of data size so big
4) we have dump backup with option --oplog

 

I want to do below
1) in failed secondary
rm data directory
MongoDB start
mongorestore with option --oplogReplay --> success

2) in primary
rs.add(secondary)
--> but start to initial sync
--> i want to sync after dump last position (how can i do ?)

in case of Mysql

change master
...
master_log_file='binary_log.000002', master_log_pos=120; --> i can begin to replicate from special position that i want



 Comments   
Comment by Danny Hatcher (Inactive) [ 20/Nov/18 ]

Hello,

Unfortunately, your proposed plan has not been tested by us so we cannot prove that it will work. I recommend that you follow one of our documented methods on resyncing a member of a replica set.

Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion in the future please post on the mongodb-user group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-users group.

Thank you,

Danny

Comment by lee mingyu [ 20/Nov/18 ]

I think that replication is based on oplog query 

the secondary will  request primary  bigger oplog entry than  already has

if secondary has a special optime in local db  i think that a inital sync is not started 

Comment by Danny Hatcher (Inactive) [ 19/Nov/18 ]

Hello,

Unfortunately, it is not possible to use mongorestore to replace an initial sync when adding a node back into a replica set. Thus, if you attempt your plan an initial sync will still be performed when you add the node back into the replica set.

Thank you,

Danny

Comment by lee mingyu [ 19/Nov/18 ]

thank you for your explanation

I am not sure whether I can use rsync and restart in some productions

though I don't test yet

I try imagination
after mongorestore with option --oplogReplay
step 1) I backed up with option(--oplog) , There was oplog(oplog.bson) , I think that I can check last oplog document
step 2) find oplog document (with step 1: last oplog document) in primary

step 3) delete all oplog contents in recovery DB

step 4) insert oplog contents(step 2) in recovery db

 

Comment by Danny Hatcher (Inactive) [ 15/Nov/18 ]

Hello,

Unfortunately, per our documentation on resyncing a member of a replicaset by copying data files, a mongodump backup can not replace the process of an initial sync. While we are working on some methods to improve our initial sync process, the current alternative is to copy the data files from a healthy node.

If you do not have the ability to take a filesystem snapshot or to halt the Primary node for a significant period of time, many customers use an iterative rsync approach to copy the data from a running process. An iterative rsync is done by running the command multiple times. Each time the length of the run should get shorter as rsync will update the data files that have been changed but leave the ones that weren't. When the length of the run is short, then you would stop the Primary process, run one last rsync, then start the Primary and Secondary processes up.

Thank you,

Danny

Generated at Thu Feb 08 04:47:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.