我正在尝试使用以下命令和配置文件为mongo分片运行配置服务器:
mongod --config /etc/mongod2.conf
mongod2.config
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb2
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
processManagement:
pidFilePath: /srv/mongodb/db2.pid
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27019
bindIp: 127.0.0.1
processManagement:
fork: true
#security:
# authorization: enabled
replication:
replSetName: configReplSet
sharding:
clusterRole: configsvr
当我运行上面的命令时,我得到以下输出(在mongo日志中没有日志输出):
about to fork child process, waiting until server is ready for connections.
forked process: 14246
ERROR: child process failed, exited with error number 1
我在ubuntu v14上运行mongo v3.2.2。端口27019不受另一个进程的约束。
答案 0 :(得分:0)
问题是因为我从未创建过单独的数据目录。当我运行以下内容时,我看到了更好的错误消息:
mongod --dbpath /var/lib/mongodb2 --port 27019
此命令提供了更好的错误消息(它显示数据目录不存在等)。这有助于解决问题,我能够运行配置服务器(下面的输出):
2016-06-29T12:21:30.216-0400 I CONTROL [initandlisten] MongoDB starting : pid=16060 port=27019 dbpath=/var/lib/mongodb2 64-bit host=abcdefghi
2016-06-29T12:21:30.216-0400 I CONTROL [initandlisten] db version v3.2.0