I have been running a shell script that starts mongod instances on different machines, initializing them (the first machines) and adding them to a replica set (the others). The following is a summary of what I ran:
Machine 1 - mongod and initiate as primary by running rs.initiate()
Machine 2 - mongod and contact primary to run rs.add()
However, when I add the second mongod instance, the response was ok, but running rs.status() on primary it shows Machine 2 in STARTUP state
{ "_id" : 1, "name" : "Machine 2", "health" : 1, "state" : 0, "stateStr" : "STARTUP", "uptime" : 30, "optime" : { "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }, "optimeDurable" : { "ts" : Timestamp(0, 0), "t" : NumberLong(-1) }, "optimeDate" : ISODate("1970-01-01T00:00:00Z"), "optimeDurableDate" : ISODate("1970-01-01T00:00:00Z"), "lastHeartbeat" : ISODate("2018-06-14T07:07:11.336Z"), "lastHeartbeatRecv" : ISODate("1970-01-01T00:00:00Z"), "pingMs" : NumberLong(0), "configVersion" : -2
Further investigation using the db.runCommand({getLog:"rs"} reveals the following:
"2018-06-14T12:23:54.223+0800 I REPL [replexec-5] Member Machine 2 is now in state RS_DOWN"
Why is my machine on STARTUP when I first add it? What is this RS_DOWN? I'm using MONGO 3.64 for both machines. I always delete local db before trying out the scripts
connection accepted from Machine 1.After that,end connection Machine 1. Between them, there isreceived client metadata from Machine 1. It is actually still running, just forever in startup mode