Replica Set Config and ReConfiguration

1,286 views
Skip to first unread message

ColinDensem

unread,
Aug 11, 2010, 6:14:28 AM8/11/10
to Mongoid
Hi, working up some scenarios on three separate VM's for a basic
replica set.

The initial config works like a dream, the replica set works as
advertised. I've now come to alter the configuration, weighting,
votes. My primary goal is to alter the configured set's ip addresses.

I can see how the nodes would be added if they were new, but not how
to remove a node from the replica set.

So I follow the rough guide from the wiki to configure a basic set:

> rs.conf();
{
"_id" : "set1",
"version" : 1,
"members" : [
{
"_id" : 0,
"host" : "192.168.1.83:27017"
},
{
"_id" : 1,
"host" : "192.168.1.85:27017"
},
{
"_id" : 2,
"host" : "192.168.1.87:27017"
}
]
}


All Good.

When I try to re-initialise with a new config / alterations, noting
I've not altered anything other than ip's, wishing I'd used
hostnames...:

config = { _id: 'set1', members:
[
{_id:0, host: '172.16.157.130:27017'},
{_id:1, host: '172.16.157.129:27017'},
{_id:2, host: '172.16.157.128:27017'}
]
}

Perhaps to be expected I get:

"errmsg" : "local.oplog.rs is not empty on the initiating member.
cannot initiate.",
"ok" : 0

So the question is how would I alter the config of the nodes, drop
nodes, alter known nodes?

Cheers,
Colin.

Kyle Banker

unread,
Aug 11, 2010, 8:10:44 AM8/11/10
to mon...@googlegroups.com
Couple things:

1. Removing nodes is a little dicey at the moment. It seems like you're replacing all three nodes heres. That's not really supported.

2. Which command did you use to initiate the second time? You need to do this:

use admin
db.runCommand({replSetReconfig: config}); 

ColinDensem

unread,
Aug 11, 2010, 2:02:05 PM8/11/10
to Mongoid
Kyle,

Thankyou...

use admin
> db.runCommand({replSetReconfig: config});

Would be the missing link I needed. If I get some work done now I
might get back to it.

The backstory here is that I built the VM's on a bridged connection,
but I've reconfigured the nics to be internal host only, so I was
trying to reconfigure the ip's, the raw data remained unchanged, an
extreme use case. But the ideas of removing a node for maintenance /
adding a new one etc would hold true. Duly noted the dicy comment,
it's still a young product, it's to be expected even in v5+ :)

Back to the back story, I have the reconfiguration in place to test
separation of the data tier from the web tier and eventually connect
from mongos processes.

Used mongod --rest --shardsvr --replSet setTest, so these three will
be shard1 hence the mongos connection.

Will go and dig on the replSetReconfig bit :)

Colin.

On Aug 11, 1:10 pm, Kyle Banker <k...@10gen.com> wrote:
> Couple things:
>
> 1. Removing nodes is a little dicey at the moment. It seems like you're
> replacing all three nodes heres. That's not really supported.
>
> 2. Which command did you use to initiate the second time? You need to do
> this:
>
> use admin
> db.runCommand({replSetReconfig: config});
>
> On Wed, Aug 11, 2010 at 6:14 AM, ColinDensem
> <colin.den...@summit360.co.uk>wrote:

Kyle Banker

unread,
Aug 11, 2010, 2:15:41 PM8/11/10
to mon...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages