Could not create stand alone csrs nodes

I attempted to create the csrs replica set. When I created the 3 nodes, which seemed to go OK they appeared to spontaneously create the replica set without invoking initiate(). I had the primary and 2 secondary nodes, but without any authorized users and I could not create the root user. I could not shutdown any of the nodes to start again because I was not authorized to do so. I had to run vagrant halt in order to start over.

I had previously created the csrs replica set, brought up mongos and connected to a sharded cluster while following the lecture without a problem. The issue occurred when I tried to do it again.

Could you explain how this can happen?
How can I stop this from happening so I can start over to do the lab?


Howard Tarko

It’s not possible to add nodes without initiating a replica set. Can you share a screenshot of the sequence of events.

It is possible that you created the first user on a db other than admin (typically test db) or you typed the username/password incorrectly during creation or login.
You have one chance (and one chance only) to create the first user, after which you must login using that user to perform other operations like creating other users, showing dbs, showing collections, CRUD operations, DML operations etc.

Try to login in using the admin db and test dbs.

vagrant halt simply shuts down the machine, that is to say, it gracefully shuts down all running processes and generally cleans up, but it doesn’t delete any data.
So if you definitely can’t login following the suggestions above, then you have two options:

  1. Find (ps -ef | grep [m]ongo) and shutdown the mongod instances (kill <pid>) and delete all the data and log files (rm -r /path/to/db or log folder/*)
  2. Start from scratch (vagrant destroy). But note that this completely removes every trace of the machine. Only do this as a last resort or if you want to start over.
1 Like

Deleting the database directory and the log files and starting from scratch was the solution. I found it in the discussion.

Passed the course!!!
Thank you very much.


Hi @Howard_84497,

The m103-csrs replica set that you created in the previous chapter has the same configuration as that of the one which we use in Lab.

Some of the issues that you have mentioned occurred because of the same reason. Thanks for sharing it. I will sync with the team and see what we can do about it.

Shubham Ranjan
Curriculum Services Engineer