MongoDB无法启动:bind_ip错误:bind()失败错误:99无法为套接字分配请求的地址

时间:2016-11-04 08:11:59

标签: linux mongodb sockets ubuntu ubuntu-14.04

我在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可用。请帮我解决这个问题

1 个答案:

答案 0 :(得分:1)

而不是公共IP 54.169.117.134使用私有IP。

当然,这会使您的数据库公开,因此如果您不希望公开访问,请确保它受授权和/或防火墙保护。