I created a replica set the other day with the following ports:
Primary - 27017
Secondary - 27020
Secondary - 27030
It worked fine. I closed all command prompts and came back to it a few days later. Now, when I run mongod in one command window, and then try to run the Primary node of my replica set using:
It may be complaining about how you started mongod rather than how you connected
How did you start mongod when it was working before?
If you ran just mongod it will bring up default mongod (without replication)
You must have used config file which has replication params
And that worked. But, if I’m not mistaken, isn’t that how you configure the replica set? I mean, am I supposed to type that each time I want to connect to the replica set? And after that add the secondary instances?
Sorry, @Ramachandra_Tummala, to intervene but you usually have replied at this time since it looks like you are a few timezone ahead of me. I am sure your reply would like:
The following is wrong:
You must used the same argument as when you started mongod the first time. That is:
Well thank you very much, Steve. I now enter the arguments like you mentioned, start up a mongod instance for each node, and than I can run the mongo “mongodb://localhost:27017,localhost:27020,localhost:27030/?replicaSet=company1repl” command and it works.
It was such a simple problem but I just couldn’t wrap my head around it. Thanks again for your time and help.