0

如何防止这些错误形成 mongoDB shell 或当我尝试从 php 连接到它时

Message: Failed to connect to: localhost:27017: Remote server has closed the connection 

JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112 exception: connect failed

couldn't connect to server 127.0.0.1 shell/mongo.js

每次出现这些错误之一时,我每次都必须运行此命令

sudo rm /var/lib/mongodb/mongod.lock   
sudo -u mongodb mongod -f /etc/mongodb.conf --repair 
sudo service mongodb start

如何在我的生产环境中永远预防和解决这些错误。

谢谢

4

0 回答 0