I am trying to create a replica set with MongoDb, the servers hostnames are:
hostname hostname-1 hostname-2
Each of these has all the relevant hostnames detailed in their /etc/hosts file (They;re all running Ubuntu 10.04 64-bit)
When I do an rs.initiate on one node everything seems to start well. Running rs.status(); shows:
{
"set" : "vega",
"date" : ISODate("2012-01-22T19:15:55Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "hostname:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"optime" : {
"t" : 1327254848000,
"i" : 1
},
"optimeDate" : ISODate("2012-01-22T17:54:08Z"),
"self" : true
}
],
"ok" : 1
}
The problem comes when I try to add a new member to the replica set. I use the command rs.add(hostname-1); and I get the following error:
{
"assertion" : "need most members up to reconfigure, not ok : vega-1:27017",
"assertionCode" : 13144,
"errmsg" : "db assertion failure",
"ok" : 0
}
I've tried numerous combinations of using the hostname, IP address, both with and without the port number and I always get the same problem. The hostname is resolving, i've tried ping hostname-1 and it works fine.
Does anybody have any ideas as to what could be causing this issue?
Unfortunately in the Mongo documentation there are no examples of setting up a replica set in the real world scenario, only using three instances on the same machine which is clearly useless.
Thanks in advance for any help!