FAQ

1.进入 mongodb 后台 shell 失败

场景:直接执行 mongo 进入后台 shell 时失败。报错如下所示:

$ mongo                      
MongoDB shell version: 2.6.11
connecting to: test
2017-02-15T14:50:53.965+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2017-02-15T14:50:53.966+0800 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

原因:启动 mongod 时指定了配置文件,而配置文件中的 bindIp 值不是 127.0.0.1。因此执行 mongo 时需要添加 --host 参数

results matching ""

    No results matching ""