2016-04-15 10:20
浏览 300


I am new to MongoDB.I installed mongodb and used with Laravel framework.Its had been worked for a long time without any issues.But currently while i try to acess my website it shows:

 Failed to connect to: localhost:27017: Connection refused 

when i try to acces mongodb via command line,it shows:

 warning: Failed to connect to, reason: errno:111    Connection refused
Error: couldn't connect to server (, connection attempt failed at src/mongo/shell/mongo.js:146 exception: connect failed

when i try to access it via rock tool,it shows:

Unable to connect MongoDB, please check your configurations. MongoDB said:Failed to connect to: Connection refused.

what i will do? I can't figure what's wrong from my part since its working after the past months.I do nothing since the last days.Thanks in advance..

图片转代码服务由CSDN问答提供 功能建议

我是MongoDB的新手。我安装了mongodb并与Laravel框架一起使用。它已经工作了很长时间没有 任何问题。但目前我尝试访问我的网站时显示:



 警告:无法连接到127.0.0.1:27017,原因:errno:  111连接被拒绝
错误:无法连接到服务器127.0.0.1:27017(,连接尝试在src / mongo / shell / mongo.js失败:146异常:连接失败


 无法连接MongoDB,请检查您的配置。  MongoDB说:无法连接到:连接被拒绝。

我将做什么? 自从过去几个月以来我的工作以来,我无法想象我的错误。自从最后几天我什么都不做。提前谢谢..

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • drh78568 2016-04-18 09:39

    After a short break, I can find out the solution. The origin of that issue is the unexpected shutdown of the system.So i run the below code in command prompt:

    sudo rm /var/lib/mongodb/mongod.lock
    mongod --repair
    sudo service mongodb start

    then after the above code run, its working fine :)

    点赞 打赏 评论