【发布时间】:2017-07-26 17:17:39
【问题描述】:
我正在尝试在 EC2 Centos 7.3 机器上启动 mongodb 3.4。
问题是rpm安装的默认启动脚本,抛出这个错误:
2017-07-26T13:01:29.820-0400 I NETWORK [websvr] admin web console waiting for connections on port 28017
2017-07-26T13:01:29.822-0400 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/local/mongo-data/diagnostic.data'
2017-07-26T13:01:29.822-0400 I REPL [initandlisten] Did not find local voted for document at startup.
2017-07-26T13:01:29.822-0400 I REPL [initandlisten] Did not find local replica set configuration document at startup; NoMatchingDocument: Did not find replica set configuration document in local.system.replset
2017-07-26T13:01:29.823-0400 I CONTROL [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2017-07-26T13:01:29.823-0400 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2017-07-26T13:01:29.823-0400 I NETWORK [signalProcessingThread] closing listening socket: 9
2017-07-26T13:01:29.823-0400 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2017-07-26T13:01:29.823-0400 I NETWORK [signalProcessingThread] shutdown: going to flush diaglog...
2017-07-26T13:01:29.823-0400 I REPL [signalProcessingThread] shutting down replication subsystems
2017-07-26T13:01:29.824-0400 I NETWORK [thread1] waiting for connections on port 27017
2017-07-26T13:01:29.824-0400 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2017-07-26T13:01:29.824-0400 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2017-07-26T13:01:29.894-0400 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2017-07-26T13:01:29.894-0400 I CONTROL [signalProcessingThread] now exiting
2017-07-26T13:01:29.894-0400 I CONTROL [signalProcessingThread] shutting down with code:0
因为我找不到任何与 [initandlisten] Did not find local voted for document at startup. 或 [initandlisten] Did not find local replica set configuration document at startup; NoMatchingDocument: Did not find replica set configuration document in local.system.replset 相关的有用信息。
我成功地启动了 mongo
mongod --config /etc/mongod.conf
而且它有效。没有问题。上面的命令我猜和systemctl start mongod开头的init脚本是一样的
我的配置文件如下所示:
systemLog:
destination: file
logAppend: true
path: /var/log/mongo/mongod.log
# Where and how to store data.
storage:
dbPath: /local/mongo-data
journal:
enabled: true
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongo.pid # location of pidfile
# network interfaces
net:
port: 27017
http:
RESTInterfaceEnabled: true
replication:
replSetName: res0
现在...也许有人可以告诉我我做错了什么以及为什么默认启动脚本不起作用。
但问题是如何用我的解决方法替换默认启动脚本...mongod --config /etc/mongod.conf
谢谢你, 加布里埃尔
【问题讨论】:
-
你还没有初始化你的副本集
res0。 -
我没有。它是由厨师自动完成的,但为了实现这一点,mongo 应该在 localhost 上启动并打开 27017 端口
-
好吧,显然出了点问题。我真的建议在使用厨师食谱之前先手动(几次)。
标签: mongodb amazon-ec2 centos7