我刚刚安装了MongoDB(标准Ubuntu构建版本,而不是最新稳定版),但出现连接问题:
Mon Feb 6 03:11:22 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:79
exception: connect failed
现在我的机器不是127.x.x.1,而是某种原因下的x.x.x.2(尽管我已经更改了配置文件以绑定到该地址,并尝试绑定到我的公共IP,但没有成功。
配置:
#mongodb.conf
# Where to store the data.
# Note: if you run mongodb as a non-root user (recommended) you may
# need to create and set permissions for this directory manually,
# e.g., if the parent directory isn't mutable by the mongodb user.
dbpath=/var/lib/mongodb
#where to log
logpath=/var/log/mongodb/mongodb.log
logappend=true
bind_ip = 199.21.114.XX
port = 27017
我已经检查了日志,只显示启动信息。
我还检查了守护进程是否在运行,而且确实在运行——我甚至尝试手动使用 --fork
运行它。
有人遇到过这种情况吗?或者有什么建议吗?
谢谢。
更新:
重启后,以下是日志:
** WARNING: You are running in OpenVZ. This is known to be broken!!!
Tue Feb 7 19:43:32 [initandlisten] db version v1.8.2, pdfile version 4.5
Tue Feb 7 19:43:32 [initandlisten] git version: nogitversion
Tue Feb 7 19:43:32 [initandlisten] build sys info: Linux allspice 2.6.24-28-se$
Tue Feb 7 19:43:32 [initandlisten] *** warning: spider monkey build without ut$
Tue Feb 7 19:43:32 [initandlisten] waiting for connections on port 27017
Tue Feb 7 19:43:32 [websvr] web admin interface listening on port 28017