Mongodb如何在同一服务器上使用不同的IP地址和端口号启动2个实例mongodb

时间:2018-07-26 21:02:07

标签: mongodb

我已经将netapp挂载为/ mongodb并具有两个不同的IP地址。一台服务器有两个节点。 Mongodb如何知道要运行哪个实例。
在配置设置中。我有两个数据库,每个节点IP上都有一个数据库(同一服务器上有多个实例)。

Server A
node1: 192.168.6.7
node2: 192.168.6.8

配置文件:mongoDB-01.conf设置参数

# Where and how to store data.
storage:
  dbPath: /var/mongodb/db/mongoDB-01
  journal:
     enabled: true

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
path: /var/mongodb/logs/log-01.log

#Network interfaces
net:
   port:25017
   bindip:192.168.6.7,127.0.0.1 

配置文件:mongoDB-02.conf设置参数

# Where and how to store data.
storage:
  dbPath: /var/mongodb/db/mongoDB-02
  journal:
    enabled: true

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
path: /var/mongodb/logs/log-02.log

#Network interfaces
net:
   port:27017
   bindip:192.168.6.8,127.0.0.1

无法启动实例之一。我是否需要将Ip地址添加到Linux IPTable并允许打开端口25017?预先感谢。

mongod --config mongoDB-01.conf &  # successful
mongod --config mongoDB-02.conf & # fail to run
about to fork child process, waiting until server is ready for connections.
forked process: 27009
ERROR: child process failed, exited with error number 100

0 个答案:

没有答案