MongoDB Startup Error: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

Mongodb login failed, report

2017-08-17T16:24:04.385+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2017-08-17T16:24:04.385+0800 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :

Such an error, and then fix it, and restart (Mongo’s path is modified by itself)

cd /usr/local/mongodb/bin
./mongod  --repair
mongod -f ../etc/mongodb.conf 

The following error was reported:

about to fork child process, waiting until server is ready for connections.
forked process: 20539
ERROR: child process failed, exited with error number 1

Solution:

Delete the lock and restart (the paths vary from person to person, but they are all under Mongo’s storage path (DB))

rm /data/mongo/db/mongod.lock

Then restart it

mongod -f ../etc/mongodb.conf 

It’s OK

Similar Posts: