Using rs.syncFrom for initial sync

550 views
Skip to first unread message

Ralf Kistner

unread,
Mar 13, 2014, 4:35:29 AM3/13/14
to mongod...@googlegroups.com
To reduce the impact on my primary node when adding a new secondary, I'd like it to perform the initial sync from an existing secondary.

The rs.syncFrom command seems perfect for that:

http://docs.mongodb.org/manual/tutorial/configure-replica-set-secondary-sync-target/

Note however, that the page mentions:

To affect the sync target for the initial sync, run rs.syncFrom() operation before initial sync.
 
My question is, how do I run rs.syncFrom before the initial sync? If I run it before the new member is added to the replica set, I get the error "can't get local.system.replset config from self or any seed (EMPTYCONFIG)". If I add the member, it immediately starts the initial sync, and I can't run the command anymore.

Regards,
Ralf Kistner



Joanna Cheng

unread,
Mar 23, 2014, 7:37:32 PM3/23/14
to mongod...@googlegroups.com
Hi Ralf,

There is actually a gap between adding a node to a replica set, and the actual initial sync process starting. During this gap, you can change the sync target using the rs.syncFrom() command. On my machine, this takes 40 seconds; however this will vary depending on your system, the type of disks you are running, how long space allocation for the oplog takes, etc. However, once the initial sync starts, you cannot change the sync target.

You can tell when the initial sync starts when you see the following lines in your mongod.log
Mon Mar 24 10:21:21.231 [rsSync] replSet initial sync pending
Mon Mar 24 10:21:21.231 [rsSync] replSet syncing to: XXXXX:27017

An alternative to this would be to sync by copying files from another member

Kind regards,
Joanna

Ralf Kistner

unread,
Mar 25, 2014, 8:20:40 AM3/25/14
to mongod...@googlegroups.com
Thanks Joanna, that explains it. Copying the files would be a better solution for us for now.

Regards,
Ralf



--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/msOFZrj5TKk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages