MongoDB was running fine, but now it won’t connect. When I run mongo
, I get this message:
MongoDB shell version: 3.2.12
connecting to: test
2017-06-23T01:56:34.256-0400 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-06-23T01:56:34.256-0400 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6
exception: connect failed
I have tried restarting the mongod service, but that doesn’t help. Can you please guide me on how to debug this issue?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
@robynover Can you delete this file and then launch mongo service:
/tmp/mongodb-27017.sock
When you start mongo directly it starts with default options. If you look at your first error logs, you’ll see it’s set to
/var/lib/mongodb
I am getting a same error. deleted /tmp/mongodb-27017.sock file. getting following error:
Thank you @hansen. I don’t have a
mongodb.log
but I do havemongod.log
: