当前位置: 代码迷 >> 综合 >> Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused(MongoDB启动异常)
  详细解决方案

Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused(MongoDB启动异常)

热度:61   发布时间:2023-12-19 09:17:21.0

原文:http://blog.csdn.net/liwuyang2013/article/details/50403831

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

  相关解决方案