Discussion:
Duplicating a ReplicaSet and its contents
(too old to reply)
Raul Martinez Jr.
2015-05-29 04:17:45 UTC
Permalink
Hello,

I've been trying to find articles or blog-post about replicaSet data
duplication but perhaps my search keywords are not correct.
Basically, I want to duplicate an existing replicaSet and replicaSet data
using the following steps



1. Given a working and established replicaSet named "REPL1" with three
(3) members A, B, C
2. Given a new set of servers that forms a new replicaSet called "REPL2"
with three (3) members C,D,E,F (F is an arbiter)
3. Stop the mongod running on Server C
4. Remove server C from REPL2
5. Modify the mongod configuration of Server C so it becomes a temporary
member of REPL1
6. Remove the contents of /var/lib/mongo/ --- to allow for initialSync
7. Start the mongod in Server C
8. Add Server C to REPL1 replicaSet (hidden: true, priority: 0)
9. Wait until Server C becomes a full fledged SECONDARY (initial sync
occurs at this time)
10. When Server C's status is SECONDARY, remove Server C from REPL1
replicaSet
11. Stop the mongod daemon in Server C
12. Modify the mongodb configuration of Server to it becomes a member of
REPL2.
13. Start the mongod daemon in Server C
14. Add Server C to REPL2 (rs.add(...))
15. Expectation: Server C will immediately join the replicaSet and I
would have forced it to become a primary and perform initial sync on the
rest of the members of REPL2.
16. BUT, I'm getting the following message:
*"lastHeartbeatMessage" : "Our replica set configuration is
invalid or does not include us",*


Can somebody point me to the right direction?


Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/619d62e1-1f6e-41cf-adae-f6c0d2831851%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
davidmo
2015-05-29 16:30:10 UTC
Permalink
Post by Raul Martinez Jr.
Hello,
I've been trying to find articles or blog-post about replicaSet data
duplication but perhaps my search keywords are not correct.
Basically, I want to duplicate an existing replicaSet and replicaSet data
using the following steps
1. Given a working and established replicaSet named "REPL1" with three
(3) members A, B, C
2. Given a new set of servers that forms a new replicaSet called
"REPL2" with three (3) members C,D,E,F (F is an arbiter)
3. Stop the mongod running on Server C
4. Remove server C from REPL2
5. Modify the mongod configuration of Server C so it becomes a
temporary member of REPL1
6. Remove the contents of /var/lib/mongo/ --- to allow for initialSync
7. Start the mongod in Server C
8. Add Server C to REPL1 replicaSet (hidden: true, priority: 0)
9. Wait until Server C becomes a full fledged SECONDARY (initial
sync occurs at this time)
10. When Server C's status is SECONDARY, remove Server C from REPL1
replicaSet
11. Stop the mongod daemon in Server C
12. Modify the mongodb configuration of Server to it becomes a member
of REPL2.
13. Start the mongod daemon in Server C
14. Add Server C to REPL2 (rs.add(...))
15. Expectation: Server C will immediately join the replicaSet and I
would have forced it to become a primary and perform initial sync on the
rest of the members of REPL2.
*"lastHeartbeatMessage" : "Our replica set configuration is
invalid or does not include us",*
Can somebody point me to the right direction?
Thanks in advance!
http://docs.mongodb.org/manual/tutorial/restore-replica-set-from-backup/

your steps 14 and 15 do not work the way you expect.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/54bc93e5-dd28-48f5-8226-13e0b50e2d1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raul Martinez Jr.
2015-05-29 16:55:05 UTC
Permalink
Thanks for pointing that out. Got it figured out. I'm updating this thread
for the benefit of others:



1. Given a working and established replicaSet named "REPL1" with three
(3) members A, B, C
2. Given a new set of servers that forms a new replicaSet called "REPL2"
with three (3) members C,D,E,F (F is an arbiter)
3. Stop the mongod running on Server C
4. Remove server C from REPL2
5. Modify the mongod configuration of Server C so it becomes a temporary
member of REPL1
6. Remove the contents of /var/lib/mongo/ --- to allow for initialSync
7. Start the mongod in Server C
8. Add Server C to REPL1 replicaSet (hidden: true, priority: 0)
9. Wait until Server C becomes a full fledged SECONDARY (initial sync
occurs at this time)
10. When Server C's status is SECONDARY, remove Server C from REPL1
replicaSet
11. Stop the mongod daemon in Server C
12. Modify the mongodb configuration of Server to it becomes a
stand-along mongodb instance e.g. no replicaSet option
13. Start the mongod daemon in Server C
14. Delete existing replicaSet record in Server C using the command

shell> mongo
mongo> use local
mongo>db.system.replset.remove({});
mongo>exit

15. Remove the contents of /var/lib/mongo of Servers D, E,F and stop the
mongod daemons for these servers
16. Modify the mongodb configuration in Server C, add replicaSet = REPL2
17. Restart the mongod daemon in Server C
18. Connect to the mongod instance in Server C and initiate the
replicaSet using rs.initiate();
19. Start the mongod daemons in Servers D, E, F
20. Back in Server C mongo session, add new members to REPL2
rs.add("server-d:27017")
rs.add("server-e:27017")
rs.addArb("server-d:27018")
21. Wait for Servers D, E to catch up.
Post by davidmo
http://docs.mongodb.org/manual/tutorial/restore-replica-set-from-backup/
your steps 14 and 15 do not work the way you expect.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/e4760c40-92c2-4683-96af-96893d1dc667%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dwayne Mcnab
2015-05-29 17:01:54 UTC
Permalink
Hi Raul,

I see what your trying to accomplish here but that is the wrong way to go
about doing a restore. Also why do you need an arbiter if your running
three nodes? An arbiter is only necessary if you have even number of data
baring nodes, say three secondaries and one primary then you would need an
arbiter to break the tie in a vote of an election occurs. Now back to your
initial problem. Here's the esiest way to solve your issue.

1 From server C on REPL2 run a mongodump from one of the secondaries on
REPL1.
2. After the dump has completed run a mongorestore on server C on REPL2
pointing it to the dump you took above.
Post by Raul Martinez Jr.
Hello,
I've been trying to find articles or blog-post about replicaSet data
duplication but perhaps my search keywords are not correct.
Basically, I want to duplicate an existing replicaSet and replicaSet data
using the following steps
1. Given a working and established replicaSet named "REPL1" with three
(3) members A, B, C
2. Given a new set of servers that forms a new replicaSet called
"REPL2" with three (3) members C,D,E,F (F is an arbiter)
3. Stop the mongod running on Server C
4. Remove server C from REPL2
5. Modify the mongod configuration of Server C so it becomes a
temporary member of REPL1
6. Remove the contents of /var/lib/mongo/ --- to allow for initialSync
7. Start the mongod in Server C
8. Add Server C to REPL1 replicaSet (hidden: true, priority: 0)
9. Wait until Server C becomes a full fledged SECONDARY (initial
sync occurs at this time)
10. When Server C's status is SECONDARY, remove Server C from REPL1
replicaSet
11. Stop the mongod daemon in Server C
12. Modify the mongodb configuration of Server to it becomes a member
of REPL2.
13. Start the mongod daemon in Server C
14. Add Server C to REPL2 (rs.add(...))
15. Expectation: Server C will immediately join the replicaSet and I
would have forced it to become a primary and perform initial sync on the
rest of the members of REPL2.
*"lastHeartbeatMessage" : "Our replica set configuration is
invalid or does not include us",*
Can somebody point me to the right direction?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/9da16bfb-4be2-4700-ba96-fda898554611%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Raul Martinez Jr.
2015-05-29 17:12:13 UTC
Permalink
Hi Dwayne,

Thanks for the feedback. Yes, I don't need an arbiter. I initially though
that since one of the server (e.g. Server E) is hidden=true, priority=0 i
cannot cast a vote during leader election... i was wrong, it can.

Regarding the use of mongodump, I intentionally skip this option. I want to
use replicaSet initial sync in this case. Thanks for pointing it out though.
Post by Dwayne Mcnab
Hi Raul,
I see what your trying to accomplish here but that is the wrong way to go
about doing a restore. Also why do you need an arbiter if your running
three nodes? An arbiter is only necessary if you have even number of data
baring nodes, say three secondaries and one primary then you would need an
arbiter to break the tie in a vote of an election occurs. Now back to your
initial problem. Here's the esiest way to solve your issue.
1 From server C on REPL2 run a mongodump from one of the secondaries on
REPL1.
2. After the dump has completed run a mongorestore on server C on REPL2
pointing it to the dump you took above.
Post by Raul Martinez Jr.
Hello,
I've been trying to find articles or blog-post about replicaSet data
duplication but perhaps my search keywords are not correct.
Basically, I want to duplicate an existing replicaSet and replicaSet data
using the following steps
1. Given a working and established replicaSet named "REPL1" with
three (3) members A, B, C
2. Given a new set of servers that forms a new replicaSet called
"REPL2" with three (3) members C,D,E,F (F is an arbiter)
3. Stop the mongod running on Server C
4. Remove server C from REPL2
5. Modify the mongod configuration of Server C so it becomes a
temporary member of REPL1
6. Remove the contents of /var/lib/mongo/ --- to allow for initialSync
7. Start the mongod in Server C
8. Add Server C to REPL1 replicaSet (hidden: true, priority: 0)
9. Wait until Server C becomes a full fledged SECONDARY (initial
sync occurs at this time)
10. When Server C's status is SECONDARY, remove Server C from REPL1
replicaSet
11. Stop the mongod daemon in Server C
12. Modify the mongodb configuration of Server to it becomes a member
of REPL2.
13. Start the mongod daemon in Server C
14. Add Server C to REPL2 (rs.add(...))
15. Expectation: Server C will immediately join the replicaSet and I
would have forced it to become a primary and perform initial sync on the
rest of the members of REPL2.
*"lastHeartbeatMessage" : "Our replica set configuration is
invalid or does not include us",*
Can somebody point me to the right direction?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/56c19552-8469-4719-90d6-d095ab0597d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dwayne Mcnab
2015-05-29 17:32:56 UTC
Permalink
No worries. Thanks for the update.
Post by Raul Martinez Jr.
Hi Dwayne,
Thanks for the feedback. Yes, I don't need an arbiter. I initially though
that since one of the server (e.g. Server E) is hidden=true, priority=0 i
cannot cast a vote during leader election... i was wrong, it can.
Regarding the use of mongodump, I intentionally skip this option. I want
to use replicaSet initial sync in this case. Thanks for pointing it out
though.
Post by Dwayne Mcnab
Hi Raul,
I see what your trying to accomplish here but that is the wrong way to go
about doing a restore. Also why do you need an arbiter if your running
three nodes? An arbiter is only necessary if you have even number of data
baring nodes, say three secondaries and one primary then you would need an
arbiter to break the tie in a vote of an election occurs. Now back to your
initial problem. Here's the esiest way to solve your issue.
1 From server C on REPL2 run a mongodump from one of the secondaries on
REPL1.
2. After the dump has completed run a mongorestore on server C on REPL2
pointing it to the dump you took above.
Post by Raul Martinez Jr.
Hello,
I've been trying to find articles or blog-post about replicaSet data
duplication but perhaps my search keywords are not correct.
Basically, I want to duplicate an existing replicaSet and replicaSet
data using the following steps
1. Given a working and established replicaSet named "REPL1" with
three (3) members A, B, C
2. Given a new set of servers that forms a new replicaSet called
"REPL2" with three (3) members C,D,E,F (F is an arbiter)
3. Stop the mongod running on Server C
4. Remove server C from REPL2
5. Modify the mongod configuration of Server C so it becomes a
temporary member of REPL1
6. Remove the contents of /var/lib/mongo/ --- to allow for initialSync
7. Start the mongod in Server C
8. Add Server C to REPL1 replicaSet (hidden: true, priority: 0)
9. Wait until Server C becomes a full fledged SECONDARY (initial
sync occurs at this time)
10. When Server C's status is SECONDARY, remove Server C from REPL1
replicaSet
11. Stop the mongod daemon in Server C
12. Modify the mongodb configuration of Server to it becomes a
member of REPL2.
13. Start the mongod daemon in Server C
14. Add Server C to REPL2 (rs.add(...))
15. Expectation: Server C will immediately join the replicaSet and I
would have forced it to become a primary and perform initial sync on the
rest of the members of REPL2.
*"lastHeartbeatMessage" : "Our replica set configuration is
invalid or does not include us",*
Can somebody point me to the right direction?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/8f915dc0-5585-43d9-9d50-1749a40f1332%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...