无法使用配置文件启动mongod

hai*_*m23 6 mongodb

我在Windows 8.1上安装了mongodb

然后我使用命令提示导航到D:\ mongodb\bin

然后我用这个命令

mongod.exe --config D:\mongodb\mongodb.conf
Run Code Online (Sandbox Code Playgroud)

mongodb.conf的内容

bind_ip = 127.0.0.1,100.100.100.100
port = 3979
quiet = true
dbpath = D:\mongodb\data\db
logpath = D:\mongodb\data\log\mongodb.log
logappend = true
journal = true
Run Code Online (Sandbox Code Playgroud)

但是mongod没有开始.如果我使用mongod.exe(不使用配置文件),它可以正常工作

更新:

我的意图很简单:将默认端口更改为另一个端口,只允许从某些IP地址访问.

我正在使用Ubuntu的配置.感谢Panda_Claus指出了新的配置.

所以我将配置更改为

net:
   bindIp: 127.0.0.1,100.100.100.100
   port: 3979
Run Code Online (Sandbox Code Playgroud)

问题是,当我使用此配置启动mongod时,它会出现错误然后自动退出

ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 100.100.100.100:3979
Run Code Online (Sandbox Code Playgroud)

那么如何只允许localhost和一个特定的IP地址(在这种情况下是100.100.100.100)连接到mongodb?

更新2

我使用了maerics的配置

net:
  bindIp: 127.0.0.1,192.168.10.104
  port: 3979
storage:
  dbPath: D:\mongodb\data\db
  journal:
    enabled: true
systemLog:
  destination: file
  path: D:\mongodb\data\log\mongodb.log
  quiet: true
  logAppend: true
Run Code Online (Sandbox Code Playgroud)

有趣的是,使用这个,我只能连接到本地机器上的数据库,其他局域网计算机无法连接

192.168.10.104:3979. 
Run Code Online (Sandbox Code Playgroud)

但是,如果我删除了

systemLog:
  destination: file
  path: D:\mongodb\data\log\mongodb.log
  quiet: true
  logAppend: true
Run Code Online (Sandbox Code Playgroud)

LAN网络中的其他计算机可以连接到数据库.

mae*_*ics 11

配置文件必须是有效的YAML.

尝试修改随文档提供的示例文件,例如:

net:
  bindIp: 127.0.0.1
  port: 3979
storage:
  dbPath: D:\mongodb\data\db
  journal:
    enabled: true
systemLog:
  destination: file
  path: D:\mongodb\data\log\mongodb.log
  quiet: true
  logAppend: true
Run Code Online (Sandbox Code Playgroud)