2017-07-26 113 views
-1

我試圖在EC2 Centos 7.3機器上啓動mongodb 3.4。修改mongodb 3.4在centos 7上的啓動7

的問題是,在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

我成功開始蒙戈與

mongod --config /etc/mongod.conf 

和它的作品。沒有問題。上面的命令我想這是一樣的初始化腳本開始systemctl start mongod

我的配置文件看起來像這樣:

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

謝謝 加布裏埃爾

+1

您尚未初始化副本集**'res0' **。 –

+0

我沒有。它是由廚師自動完成的,但爲了實現這一點,mongo應該啓動並打開本地主機上的27017端口 – gbaii

+0

呃,顯然出了問題。我真的建議在使用廚師食譜之前先手動(幾次)。 –

回答

0

問題是,用廚師我是從模板默認的數據文件夾和改變日誌文件夾和selinux拒絕訪問他們。調整selinux以允許mongod用戶解決了這個問題。

謝謝大家的回答。