Rs.initiate() not working as needed



getting error messge there are no users authenticated
Not sure why


How did you connect? mongo --port port number or differently?
What does rs.status(),rs.conf() show
ps -ef|grep -i mongo

Hi Ramchandra,
I connected using mongo --port port_number in this case port_number was my PRIMARY node
rs.status() was fine showed all the details like primary and which are secondary

vagrant@m103:~$ ps -ef | grep -i mongo
vagrant 2360 1 3 04:51 ? 00:02:09 mongod --config /vagrant/shared/mongod-repl-1.conf
vagrant 2437 1 3 04:52 ? 00:02:12 mongod --config /vagrant/shared/mongod-repl-2.conf
vagrant 2520 1 3 04:52 ? 00:02:11 mongod --config /vagrant/shared/mongod-repl-3.conf
vagrant 2612 2340 0 04:52 pts/0 00:00:01 mongo --port 27001
vagrant 3179 2781 0 05:55 pts/1 00:00:00 grep --color=auto -i mongo

May be you have competed rs.initialise()
What does rs.status() show?
Your prompt shows replica-primary

Should be something like this when you connect first time
vagrant@m103:/dataset$ mongo --port 27001
MongoDB shell version v3.6.9
connecting to: mongodb://
Implicit session: session { “id” : UUID(“d04ba757-0851-4c0a-8ade-14205db0b07c”) }
MongoDB server version: 3.6.9
MongoDB Enterprise > db
MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise > rs.initiate()
“info2” : “no configuration specified. Using a default configuration for the set”,

Create user then add other members

The error message is there are no users authenticated. This means you have to authenticate, probably with a user name and password.

Thanks for your responses.
It was not allowing me to even run
MongoDB Enterprise > show dbs
I killed all the mongod processes and restarted. It worked

Thanks Steevej,

I killed all the processes and restarted and authenticated and all worked fine.