Confirming MongoDB replica set and arbiter

991 views
Skip to first unread message

integrativeadmin

unread,
Oct 23, 2013, 12:03:40 PM10/23/13
to mongod...@googlegroups.com
I think I successfully created a mongodb replica set with an arbiter.  When I run rs.status() on the primary, I get the following:

    rs0:PRIMARY> rs.status()
    {
    "set" : "rs0",
    "date" : ISODate("2013-10-23T15:11:27Z"),
    "myState" : 1,
    "members" : [
    {
    "_id" : 0,
    "name" : "10.50.1.10:27017",
    "health" : 1,
    "state" : 1,
    "stateStr" : "PRIMARY",
    "uptime" : 71210,
    "optime" : Timestamp(1382539219, 1),
    "optimeDate" : ISODate("2013-10-23T14:40:19Z"),
    "self" : true
    },
    {
    "_id" : 1,
    "name" : "10.50.3.10:27017",
    "health" : 1,
    "state" : 2,
    "stateStr" : "SECONDARY",
    "uptime" : 2362,
    "optime" : Timestamp(1382539219, 1),
    "optimeDate" : ISODate("2013-10-23T14:40:19Z"),
    "lastHeartbeat" : ISODate("2013-10-23T15:11:26Z"),
    "lastHeartbeatRecv" : ISODate("2013-10-23T15:11:26Z"),
    "pingMs" : 1,
    "syncingTo" : "10.50.1.10:27017"
    },
    {
    "_id" : 2,
    "name" : "mongodb2.iin:30000",
    "health" : 0,
    "state" : 8,
    "stateStr" : "(not reachable/healthy)",
    "uptime" : 0,
    "lastHeartbeat" : ISODate("2013-10-23T15:11:26Z"),
    "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
    "pingMs" : 0
    }
    ],
    "ok" : 1

Towards the bottom, the arbiter is showing as stateStr : not reachable/healthy.  Is that normal?  

I plan on testing the replica set by simulating a failover process by shutting down the primary and see it failover.  I would shut down the primary and then log into the slave and it should eventually be the primary, correct?  What's the best practice in having the MongoDB automatically startup upon a reboot?  I'm using a config file so I would need to add the command "mongod --config /etc/mongodb.conf" to a bash script and execute on boot?

Russell Bateman

unread,
Oct 23, 2013, 12:41:52 PM10/23/13
to mongod...@googlegroups.com
Yes, that's what I would expect for the arbiter.
--
--
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 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.
For more options, visit https://groups.google.com/groups/opt_out.

CC XW

unread,
Mar 25, 2015, 2:42:39 PM3/25/15
to mongod...@googlegroups.com
Hi,integrativeadmin  ,
   I have got the same error. I have 2 replica sets. Each has two members -Primary and Secondary. Alter I  used rs.addArb() to add the arbiter to each replicaSet with no problem. All the mongod services are running fine.
   I run rs.config() and rs.status(). I got the same status : (not reachable/healthy).

   Have you figured out how to get out of this status?
   I am using Mongod 2.6.7 on Unix servers.

   Please share your information in advance.

   Thank you!

CC XW

Dwight Merriman

unread,
Mar 25, 2015, 3:24:46 PM3/25/15
to mongod...@googlegroups.com
not reachable is not normal.

can you connect to the arbiter with the mongo shell?  


On Wednesday, October 23, 2013 at 12:03:40 PM UTC-4, integrativeadmin wrote:

Alberto Frosi

unread,
Mar 25, 2015, 5:19:19 PM3/25/15
to mongod...@googlegroups.com
Normally in these cases host could have a network issue.

Alberto Frosi

unread,
Mar 25, 2015, 5:27:15 PM3/25/15
to mongod...@googlegroups.com
...or wrong host name or port in RS.addArb command.

CC XW

unread,
Mar 26, 2015, 2:18:29 PM3/26/15
to mongod...@googlegroups.com
But, I could see the process is up running. I could even connect to it (arbiter) using mongo -port .
After I issue the command
rs.addArb("devrs1/MyHost01.mydomain.com:27028");
I got the result like this

{
    "down" : [
        "devrs1/MyHost01.mydomain.com:27028"
    ],
    "ok" : 1
}

Alberto Frosi

unread,
Mar 27, 2015, 4:43:16 AM3/27/15
to mongod...@googlegroups.com
Mmm very strange, can you take a look in arbiter log ?

I ran a small test in my VM with 1P, 2S and 1 Arb:

mongod --smallfiles --oplogSize 50 --port 27008 --dbpath z1 --replSet z --fork --logpath z1/a.log
mongod --smallfiles --oplogSize 50 --port 27009 --dbpath z2 --replSet z --fork --logpath z2/b.log
mongod --smallfiles --oplogSize 50 --port 27010 --dbpath z3 --replSet z --fork --logpath z3/c.log
mongod --fork --logpath arb/arb.log --port 30000 --dbpath arb --replSet z

I add the member in replica set and the arbiter, initiate replica and all work fine


MongoDB shell version: 2.6.4
connecting to: 127.0.0.1:27008/test
z:PRIMARY> 
z:PRIMARY> 
z:PRIMARY> rs.addArb("m202-ubuntu1404:30000")
{ "ok" : 1 }
z:PRIMARY> rs.config()
{
"_id" : "z",
"version" : 4,
"members" : [
{
"_id" : 0,
"host" : "m202-ubuntu1404:27008"
},
{
"_id" : 1,
"host" : "m202-ubuntu1404:27009"
},
{
"_id" : 2,
"host" : "m202-ubuntu1404:27010"
},
{
"_id" : 3,
"host" : "m202-ubuntu1404:30000",
"arbiterOnly" : true
}
]
}
z:PRIMARY> rs.status()
{
"set" : "z",
"date" : ISODate("2015-03-27T08:32:54Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "m202-ubuntu1404:27008",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 629,
"optime" : Timestamp(1427445157, 1),
"optimeDate" : ISODate("2015-03-27T08:32:37Z"),
"electionTime" : Timestamp(1427444638, 2),
"electionDate" : ISODate("2015-03-27T08:23:58Z"),
"self" : true
},
{
"_id" : 1,
"name" : "m202-ubuntu1404:27009",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 369,
"optime" : Timestamp(1427445157, 1),
"optimeDate" : ISODate("2015-03-27T08:32:37Z"),
"lastHeartbeat" : ISODate("2015-03-27T08:32:53Z"),
"lastHeartbeatRecv" : ISODate("2015-03-27T08:32:54Z"),
"pingMs" : 0,
"syncingTo" : "m202-ubuntu1404:27008"
},
{
"_id" : 2,
"name" : "m202-ubuntu1404:27010",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 362,
"optime" : Timestamp(1427445157, 1),
"optimeDate" : ISODate("2015-03-27T08:32:37Z"),
"lastHeartbeat" : ISODate("2015-03-27T08:32:54Z"),
"lastHeartbeatRecv" : ISODate("2015-03-27T08:32:53Z"),
"pingMs" : 0,
"syncingTo" : "m202-ubuntu1404:27008"
},
{
"_id" : 3,
"name" : "m202-ubuntu1404:30000",
"health" : 1,
"state" : 7,
"stateStr" : "ARBITER",
"uptime" : 17,
"lastHeartbeat" : ISODate("2015-03-27T08:32:53Z"),
"lastHeartbeatRecv" : ISODate("2015-03-27T08:32:53Z"),
"pingMs" : 0
}
],
"ok" : 1
}
z:PRIMARY> exit

AP

unread,
Apr 10, 2015, 3:10:56 PM4/10/15
to mongod...@googlegroups.com
I had a same issue as described in the OP. I figured out that was because of the journal and small files settings (as described in the consideration section here). I had put "journal=false" and "smallFiles=true" for my arbiter which seems to be a fine thing to do and was abl to start arbiter service with no issues. But after adding arbiter to replica set with other replicas the rs.status() was showing "arbiter => stuats(8): not reachable/healthy". It started showing stateStr as "ARBITER" ans state as 7 once I removed journal and smallfiles settings from conf. For some reason just modifying the conf didn't work. Had to delete the service and re-create it. But it worked. I wonder why these two recommended settings didn't work! 

Don't know if it is the right thing... but it worked! Hope it helps!
Reply all
Reply to author
Forward
0 new messages