Best way to convert a standalone to a Replica Set

75 views
Skip to first unread message

linbo liao

unread,
Sep 18, 2014, 3:07:10 AM9/18/14
to mongod...@googlegroups.com
Hi,

My app now is using standalone mongodb in production environment, I want to convert it to a Replica Set.  Lookup the document, it has some solution to do it.

1. Refer to http://docs.mongodb.org/v2.2/tutorial/convert-standalone-to-replica-set/,  convert it to Replica set and add member to new Replica set. 

2. Build a new Replica set, dump old data and restore to new Replica set. But it will take some time to dump data.


For first solution, I have some doubt.

1. my standalone mongodb has production data, convert it to replica set, will it lose data? 

2. If operation failed, can it recover?

3. Any other risk for this solution?

Thanks,
Linbo

Will Berkeley

unread,
Sep 18, 2014, 2:42:02 PM9/18/14
to mongod...@googlegroups.com
There's no risk for option #1. Just follow the instructions. The data isn't touched at all by the conversion to a replica set; there are collections added in the local database with replica set information but no interaction with your data outside of local. You won't lose data. If, somehow, through some craziness, you can't get the server to come up as a replica set, you can always restart it as a standalone and go back to things as they were.

-Will

linbo liao

unread,
Sep 18, 2014, 10:27:31 PM9/18/14
to mongod...@googlegroups.com
Thanks, I will have a try.

在 2014年9月19日星期五UTC+8上午2时42分02秒,Will Berkeley写道:
Reply all
Reply to author
Forward
0 new messages