dongqu9972 2016-04-15 10:20
浏览 349
已采纳

Mongodb:连接失败

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 127.0.0.1:27017, reason: errno:111    Connection refused
Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), 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: 127.0.0.1:27017: 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..

  • 写回答

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测