I am trying to setup a replica set, but when I issue:
rs.initiate()
On the first server, I get the following error:
{ "errmsg" : "need to login", "ok" : 0 }
That is strange though, because in my configuration auth: true
is commented out.
Any ideas?
Best Answer
You may have
auth: true
commented out, but did you start with--auth
or--keyFile
or specifykeyFile
in the config file? Setting thekeyFile
enables authentication implicitly, so that could be your issue here.If you want to be completely sure, temporarily shut down the
mongod
instance and start it manually, specifying only the basics (port, replica set name etc.) explicitly. At least then you can be sure of what is and is not enabled.For a running instance you can get the current options parsed from the top of the log file for the instance - they are printed out as part of the startup messaging. You can also get them by running:
getCmdLineOpts
(note though that this requires admin rights, so you may see issues if you are running with auth on and don't have an admin user defined).