2

I am trying to set up mongodb on my own server and connect to it remotely through my laptop.

I had successfully installed the database and created my own user with admin privileges. However, when I shutdown the server and restarted it, I try to run it through

mongod

and get

***aborting after invariant() failure

This error seems to be because I'm not passing in the correct credentials, but I cannot find any documentation on how to log in and start the instance using the new user I created. I've only found very old solutions through searching on my own that no longer seem to apply.

How do I connect to it, and then demand authorization from remote connections?

  • Did you manage to resolve the issue? For errors like this you need to include the full context (log lines before/after) as "invariant" doesn't narrow down the problem. Given your description, my guess is that the directory and/or files in your dbPath (by default c:\data\db were owned by the original user with admin permissions, and you didn't correct the permissions to allow the new user full access. – Stennie Sep 24 '15 at 9:51
1

Deleting .ns file in data/db worked for me.

Invariant failure usually occurs if mongo is not been shut down properly, and improper shutdown will corrupt .ns (namespace that mongo creates for each database) file. So deleting .ns file will solve the issue.

  • Any reason why this answer was downvoted so much? Does it not work? – Soulzityr Jan 11 '16 at 21:34
  • This was the only solution that worked for me in my dev environment, so thanks. – AndyH May 25 '16 at 7:25
  • For anyone wondering about the downvotes, they were added when the answer suggested deleting files before explaining why. – Tom V - try topanswers.xyz Dec 3 '16 at 9:09
0
  1. You can just go to your mongod.conf file which is present in /etc in case of ubuntu and comment it and then start your server without authentication. or
  2. type mongod --auth in case of authorisation and then mongo -u username -p password --authenticationDatabase admin

  3. type mongod --noauth then mongo will start with no authentication and you can create a new user

For more info check out this question

  • Hey there. Thanks for the answer and sorry it took me so long to reply. But for 1, I cannot find the mongod.conf and I am using Windows Server 2008. Mongod --auth also just triggers the same invariant failure. – Soulzityr Sep 5 '15 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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