0

I configured a 3 node replica set and uninstalled mongo when my virtual memory limit exceeded then as i was starting my mongo replication I couldn't get these commands to work.

rs.initiate()
rs.reconfig()//with config params

My previous replica set has primary(27017),secondary(27018,27019) After reinstalling I could get secondary to work but my primary is saying

no replica set conf has been found.

I don't understand what actually happened. Either I miss some files or mongo wants me to learn more about it. Please need advice asap.

cakan
  • 2,099
  • 5
  • 32
  • 42
Prem Reddy
  • 11
  • 1
  • 5

1 Answers1

0

rs.initiate requires a config document. Give it that while calling rs.initiate.

config = {
_id : "name_of_replica_set", members : [
    { _id : 0, host : "localhost:27017" },
    { _id : 1, host : "localhost:27018" },
    { _id : 2, host : "localhost:27019" }
    ]
};
rs.initiate(config);

Try this and see if it works for you.

Vince Bowdren
  • 8,326
  • 3
  • 31
  • 56
SiddAjmera
  • 38,129
  • 5
  • 72
  • 110
  • Why should that be necessary? The replica set still is there and basically only a new member was added. – Markus W Mahlberg Feb 23 '16 at 13:04
  • I don't find him mentioning anything about the addition of a new member. But then he mentioned that he is able to connect to the secondaries. So he should definitely be able to connect to primary. I suggested this because the error message was about the absence of configuration. – SiddAjmera Feb 23 '16 at 13:18
  • Read closely: "I got my __secondary__ to work". He removed the old primary and then set that up again. Only the primary. And the other machines still build a replica set of two members. Now, what would it be called to have the newly set up machine and the remaining replica set build a new one? – Markus W Mahlberg Feb 23 '16 at 13:35
  • Markus is right.I reinstalled mongo and started secondaries as they are with command supplying dbpath,port and replicaset name.But when i did rs.status i got primary gone and there's no way i can get that back and then the secondaries went into RECOVERING. – Prem Reddy Mar 07 '16 at 12:15
  • I did what you said siddharth.Still no luck.I'll post the output here. – Prem Reddy Mar 07 '16 at 12:17