systemctl restart mongod 起動エラー the control process exited with error code.

WikiサービスのDBとしてフリーで使えるmongoDBをCentOS7のサーバに導入しました。

 

そして、mongodのサービス再起動で以下のエラーが出力されました。

 

[root@localhost ~]# systemctl restart mongod
Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.

 


原因は、権限が不足しているようで、以下を設定することで解消します。

# chown -R mongod.mongod /usr/local/mongodb/conf/mongodb-keyfile

 

MongoDBはデフォルトではユーザーが作成されておらず、セキュリティ的に問題があるので、ユーザー追加作業の流れで発生しました。

 

重要なデータを格納するDBの場合は、権限やセキュリティを厳しくする必要があります。