Adding a new node makes it always become arbiter instead of secondary

52 views
Skip to first unread message

Jean Baptiste Favre

unread,
Oct 9, 2012, 7:43:14 AM10/9/12
to mongod...@googlegroups.com
Hello,
I'm trying to add a new mongodb node to an existing 2 members replica
set (currently running mongodb 2.0.2 from 10gen packages on Ubuntu 10.04
Lucid).

So, I start new mongodb service with replSet option, then go on primary
node and execute:
rs.add("mynewnode",{priority:0})

New node is added, but *always* as ARBITER and not SECONDARY.
Therefore, he has no data, which obviously is not what I want.

Is there any way to change a node's rule from ARBITER to SECONDARY ?
Seems that I have to remove node and add it back again, but even after
many tries, new node is always promoted as ARBITER.

Any idea welcome,
Jean Baptiste

Stephen Lee

unread,
Oct 9, 2012, 11:00:26 AM10/9/12
to mongod...@googlegroups.com
Could you provide the full mongod command (plus command line arguments) that you ran?

Jean Baptiste Favre

unread,
Oct 9, 2012, 11:07:03 AM10/9/12
to mongod...@googlegroups.com
Hello,

Simply started new mongodb node "mynewnode" with replSet option in config file. Config file is as follow:

dbpath=/var/lib/mongodb
logpath=/var/log/mongodb/mongodb.log
logappend=true
replSet = myreplsetname

Then, on master node, ran in mongo shell:

rs.add("mynewnode",{priority:0})

Not more, not less :)

Regards,
Jean Baptiste
--
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

Stephen Lee

unread,
Oct 9, 2012, 4:38:05 PM10/9/12
to mongod...@googlegroups.com, jean.bapt...@gmail.com
The second argument of rs.add() is not the member options, eg. priority, hidden, etc.  The second argument is whether the new node is an arbiter, and {priority:0} happens to evaluate to true.  Hence, your new node actually becomes an arbiter.

Instead of using rs.add(), try 

conf = rs.conf();
conf.members[ conf.members.length ] = { _id: conf.members.length, host: "mynewnode:12345", priority: 0 };
rs.reconf( conf );

to add the node.

-Stephen
Reply all
Reply to author
Forward
0 new messages