RS stuck in Secondary/Startup after adding first member

2,929 views
Skip to first unread message

Stephen Nguyen

unread,
Jan 21, 2016, 5:54:35 PM1/21/16
to mongodb-user
On my primary node I add a member, afterwards I call re.status() and my primary node is now a secondary with the added node stuck in a STARTUP state.



rsABC:PRIMARY> rs.add("10.2.28.2:27017")
{ "ok" : 1 }

rsABC:SECONDARY> rs.status()
{
"set" : "rsABC",
"date" : ISODate("2016-01-21T22:13:11.330Z"),
"myState" : 2,
"term" : NumberLong(5),
"heartbeatIntervalMillis" : NumberLong(2000),
"members" : [
{
"_id" : 0,
"name" : "mongo-1-uf5mk:27017",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 4821,
"optime" : {
"ts" : Timestamp(1453414352, 1),
"t" : NumberLong(5)
},
"optimeDate" : ISODate("2016-01-21T22:12:32Z"),
"infoMessage" : "could not find member to sync from",
"configVersion" : 247065,
"self" : true
},
{
"_id" : 1,
"name" : "10.2.28.2:27017",
"health" : 1,
"state" : 0,
"stateStr" : "STARTUP",
"uptime" : 28,
"optime" : {
"ts" : Timestamp(0, 0),
"t" : NumberLong(-1)
},
"optimeDate" : ISODate("1970-01-01T00:00:00Z"),
"lastHeartbeat" : ISODate("2016-01-21T22:13:07.594Z"),
"lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"),
"pingMs" : NumberLong(8),
"configVersion" : -2
}
],
"ok" : 1
}



on the member node I am adding when I run rs.status() I recieve this
rs.status()
{
"info" : "run rs.initiate(...) if not yet done for the set",
"ok" : 0,
"errmsg" : "no replset config has been received",
"code" : 94
}

Wan Bachtiar

unread,
Jan 29, 2016, 1:23:51 AM1/29/16
to mongodb-user

Hi Stephen,

Make sure you only use rs.initiate() on the intended primary node. See Deploy Replica Set for detailed steps.

Also, make sure to test the connections between the nodes.

For consistency, you should use either all IP addresses or hostnames in your replica set. i.e. 10.2.28.2 or mongo-1-uf5mk.

If you are still having issues with setting up a replica set, could you provide the following information:

  • MongoDB version(s).
  • Is this the first attempt of setting up a replica set on the dbpath? Or was it part of previous failed attempts ?
  • Could you post snippets of the log file in regards to election or why the primary step down ?

You may also find Replica Set Tutorials a useful read.

Regards,

Wan.

Natarajan P

unread,
Feb 4, 2016, 8:41:20 AM2/4/16
to mongodb-user
Hi Stephen, I've the exact issue as your's, Could you please help me with the fix you did?

Regards,
Natarajan

Wan Bachtiar

unread,
Feb 4, 2016, 9:20:02 AM2/4/16
to mongodb-user

Hi Natarajan,

Although you may share a similar error message, it may be a different issue that is causing it.

Could you please start a new disccusion with relevant details of:

  • MongoDB version(s)
  • If you are running a replica set, please post the output of rs.status()
  • Description of the issue that you are having, and any error messages that you are seeing.

You may find these useful:


Regards,

Wan.

Natarajan P

unread,
Feb 4, 2016, 9:58:10 AM2/4/16
to mongodb-user
Hi Wan, thanks for the reply.. I've started a new discussion, here is it https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/pyJTqwsOw6E

vis

unread,
Jan 19, 2017, 4:59:53 PM1/19/17
to mongodb-user
in fact, the problem is that server's 0 host "mongo-1-uf5mk" doesn't resolve from the other mongo server "10.2.28.2". This is a problem from is.initiate() not taking the good host name...

avishek sharma

unread,
Mar 22, 2017, 4:29:12 PM3/22/17
to mongodb-user, ste...@clusterhq.com
Hi All

Me too facing the same issue.
As I ran the command rs.status() after adding one server using command rs.add().
Got the message as in below screenshot and Primary server converted to secondary.

"Error: error during the query: failed: netwrok error while attempting to run command ;replSetGetStatus' on  host 127.0.0.1:27017
trying reconnect to 127.0.0.1:27017{127.0.0.1} failed
reconect 127.0.0.1:27017{127.0.0.1} ok
myitsocial:SECONDARY>

Kevin Adistambha

unread,
Apr 3, 2017, 7:59:48 PM4/3/17
to mongodb-user

Hi Avishek

Me too facing the same issue.

Please note that you are replying to an old thread that is almost certain to have a different cause, although the symptom might look similar at first glance.

If you’re still having an issue, could you please open a new thread with more details. In the new thread, could you post:

  • Your MongoDB version and your OS version
  • Your provisioned hardware (e.g. CPU, RAM, whether multiple mongod processes are running within one server, virtualized or otherwise)
  • What issue are you facing
  • What is your goal
  • What steps did you take that resulted in the issue
  • What steps did you try to address the issue
  • What are the mongod logs showing at the time of the issue
  • Any error message you observed (from any driver, mongo shell, etc.)
  • Output of rs.status() (since this appears to be a replica set)

Providing detailed information regarding your situation and your goal would help the community to quickly ascertain the source of the problem, and hopefully provide a solution that can achieve your goal.

Best regards,
Kevin

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages