Mongodb:连接失败

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

 无法连接到:localhost:27017:连接被拒绝
</ code> </ pre>

当我尝试通过命令行访问mongodb时,它显示:</ p>

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

当我尝试通过摇滚工具访问它时,它显示:</ p>

 无法连接MongoDB,请检查您的配置。  MongoDB说:无法连接到:127.0.0.1:27017:连接被拒绝。
</ code> </ pre>

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

展开原文

原文

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..

douming4359
douming4359 我试过。但我得到相同的错误消息:无法连接到127.0.0.1:27017,原因:错误:111
4 年多之前 回复
dso0139
dso0139 我猜你已经检查过MongoD进程正在运行?
4 年多之前 回复

1个回答



短暂的休息后,我可以找到解决方案。
该问题的根源是系统的意外关闭。所以我 在命令提示符下运行以下代码:</ p>

  sudo rm /var/lib/mongodb/mongod.lock
mongod --repair
sudo service mongodb start
</ code> </ pre>

然后在上面的代码运行之后,它的工作正常:)</ p>
</ div>

展开原文

原文

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问