Mongo no longer connects

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, 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, connection attempt failed :

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?

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Accepted Answer

@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:

2019-10-23T08:50:08.484-0400 I CONTROL  [initandlisten] MongoDB starting : pid=2756 port=27017 dbpath=/data/db 64-bit host=AEC-logs-mongodb-512mb-nyc3-01
2019-10-23T08:50:08.484-0400 I CONTROL  [initandlisten] db version v3.2.19
2019-10-23T08:50:08.484-0400 I CONTROL  [initandlisten] git version: a9f574de6a566a58b24d126b44a56718d181e989
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten] allocator: tcmalloc
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten] modules: none
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten] build environment:
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten]     distmod: ubuntu1404
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten]     distarch: x86_64
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2019-10-23T08:50:08.485-0400 I CONTROL  [initandlisten] options: {}
2019-10-23T08:50:08.511-0400 I -        [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-10-23T08:50:08.512-0400 W -        [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2019-10-23T08:50:08.512-0400 W STORAGE  [initandlisten] Recovering data from the last clean checkpoint.
2019-10-23T08:50:08.512-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),
2019-10-23T08:50:08.566-0400 I STORAGE  [initandlisten] dropping unused ident: index-0-3415813987516495599
2019-10-23T08:50:08.567-0400 I STORAGE  [initandlisten] dropping unused ident: index-1-3415813987516495599
2019-10-23T08:50:08.567-0400 I STORAGE  [initandlisten] dropping unused ident: index-2-3415813987516495599
2019-10-23T08:50:08.568-0400 I STORAGE  [initandlisten] dropping unused ident: index-3-3415813987516495599
2019-10-23T08:50:08.568-0400 I STORAGE  [initandlisten] dropping unused ident: index-4-3415813987516495599
2019-10-23T08:50:08.569-0400 I STORAGE  [initandlisten] dropping unused ident: index-5-3415813987516495599
2019-10-23T08:50:08.570-0400 I STORAGE  [initandlisten] dropping unused ident: index-6-3415813987516495599
2019-10-23T08:50:08.571-0400 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-10-23T08:50:08.571-0400 I CONTROL  [initandlisten] 
2019-10-23T08:50:08.571-0400 I -        [initandlisten] Fatal assertion 28579 UnsupportedFormat: Unable to find metadata for table:index-1--4778676036905453176 Index: {name: _id_, ns: local.customers} - version too new for this mongod. See for detailed instructions on how to handle this error.
2019-10-23T08:50:08.572-0400 I -        [initandlisten] 

Thank you @hansen. I don’t have a mongodb.log but I do have mongod.log:

2017-06-23T01:48:28.663-0400 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-06-23T01:48:28.663-0400 I CONTROL  [initandlisten]     distarch: x86_64
2017-06-23T01:48:28.663-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2017-06-23T01:48:28.663-0400 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-06-23T01:48:28.720-0400 E NETWORK  [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2017-06-23T01:48:28.720-0400 I -        [initandlisten] Fatal Assertion 28578
2017-06-23T01:48:28.720-0400 I -        [initandlisten] 

***aborting after fassert() failure

2017-06-23T01:56:30.912-0400 I CONTROL  [main] ***** SERVER RESTARTED *****
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] MongoDB starting : pid=19105 port=27017 dbpath=/var/lib/mongodb 64-bit host=currency
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] db version v3.2.12
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] git version: ef3e1bc78e997f0d9f22f45aeb1d8e3b6ac14a14
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] allocator: tcmalloc
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] modules: none
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] build environment:
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten]     distmod: ubuntu1604
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten]     distarch: x86_64
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2017-06-23T01:56:30.930-0400 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-06-23T01:56:30.976-0400 E NETWORK  [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2017-06-23T01:56:30.976-0400 I -        [initandlisten] Fatal Assertion 28578
2017-06-23T01:56:30.976-0400 I -        [initandlisten] 

***aborting after fassert() failure

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel