Heim > Fragen und Antworten > Hauptteil
MongoDB shell version v3.4.2
connecting to: mongodb://127.0.0.1:27017
2017-03-01T12:06:59.013+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-03-01T12:06:59.015+0800 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
淡淡烟草味2017-05-02 09:27:24
先尝试重启mongodb:
sudo service mongod restart
如果不行,则删除数据目录(默认数据目录为/var/lib/mongodb)下的mongod.lock
文件,重试上步