Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You may have auth: true commented out, but did you start with --auth or --keyFile or specify keyFile in the config file? Setting the keyFile 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).

share|improve this answer
    
That was the problem, had keyFile on. –  Justin Dec 6 '12 at 21:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.