我在MongoDB文档中遵循mongodb-org
的安装说明。我的Ubuntu版本是14.04。这是我的/etc/mongod.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,54.169.117.134
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
当我尝试sudo service mongod start
时,它会返回mongod start/running, process 6400
,但sudo service mongod status
始终返回mongod stop/waiting
,因此我会检查/var/log/mongodb/mongod.log
并获取此信息:
2016-11-04T14:59:21.366+0700 E NETWORK [initandlisten] listen(): bind() failed errno:99 Cannot assign requested address for socket: 54.169.117.134:27017
2016-11-04T14:59:21.366+0700 E STORAGE [initandlisten] Failed to set up sockets during startup.
2016-11-04T14:59:21.366+0700 I CONTROL [initandlisten] dbexit: rc: 48
我甚至运行此命令行来检查另一个进程是否在端口27017 sudo netstat -peant | grep ":27017"
上运行,但没有任何正在运行该端口,这意味着端口27017可用。请帮我解决这个问题
答案 0 :(得分:1)
而不是公共IP 54.169.117.134
使用私有IP。
当然,这会使您的数据库公开,因此如果您不希望公开访问,请确保它受授权和/或防火墙保护。