mongdb启动异常:
Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
1、若数据库出现如上不能连接的原因,可能是data目录下的mongod.lock文件问题,可以用如下命令修复:
[root@localhost ~]# cd /usr/local/mongodb/
[root@localhost mongodb]# ./bin/mongod --repair
2015-09-01T18:25:40.659+0800 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
或者直接删除mongod.lock。
[root@localhost mongodb]# rm -f /usr/local/mongodb/data/db/mongod.lock
然后再重新启动MONGODB
[root@localhost ~]# mongod -f /etc/monogdb.conf
note: noprealloc may hurt performance in many applications
about to fork child process, waiting until server is ready for connections.
forked process: 4935
child process started successfully, parent exiting