2016-09-21 13 views
2

上のサービスとして起動に失敗:MongoDBの3.2.9は、私はCentOSの上のサービスとしてのmongodを起動しようとしていますCentOSの

mongod --version 
db version v3.2.9 
git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c 
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013 
allocator: tcmalloc 
modules: none 
build environment: 
    distmod: rhel70 
    distarch: x86_64 
    target_arch: x86_64 

CentOS Linux release 7.2.1511 (Core) 

は/ etc/selinuxに/設定:

# This file controls the state of SELinux on the system. 
# SELINUX= can take one of these three values: 
#  enforcing - SELinux security policy is enforced. 
#  permissive - SELinux prints warnings instead of enforcing. 
#  disabled - No SELinux policy is loaded. 
SELINUX=disabled 
# SELINUXTYPE= can take one of three two values: 
#  targeted - Targeted processes are protected, 
#  minimum - Modification of targeted policy. Only selected processes are protected. 
#  mls - Multi Level Security protection. 
SELINUXTYPE=targeted 

のmongod。 CONF:

systemLog: 
    destination: file 
    path: "/mnt/log/mongod.log" 
    logAppend: true 
storage: 
    dbPath: "/mnt/data" 
    engine: wiredTiger 
    journal: 
     enabled: true 
processManagement: 
    fork: true 
    pidFilePath: "/var/run/mongodb/mongod.pid" 
net: 
    # bindIp: 127.0.0.1 
    port: 27017 
replication: 
    replSetName: XXXX 
security: 
    keyFile: "/usr/mongodb/mongodb-keyfile" 

問題の状態:

Starting mongod (via systemctl): Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details. 
                  [FAILED] 

journalctl -xe 
... 
Sep 20 13:10:55 ip-10-0-231-19.localdomain systemd[1]: Unit mongod.service entered failed state. 
Sep 20 13:10:55 ip-10-0-231-19.localdomain systemd[1]: mongod.service failed. 
Sep 20 13:10:55 ip-10-0-231-19.localdomain polkitd[9717]: Unregistered Authentication Agent for unix-process:26567:1630816 (system bus name :1.27, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus) 
Sep 20 13:11:04 ip-10-0-231-19.localdomain sudo[26587]: centos : TTY=pts/1 ; PWD=/home/centos ; USER=root ; COMMAND=/bin/vi /etc/mongod.conf 

サーバが使用して起動します:

sudo mongod -f /etc/mongod.conf 

私は同様の問題が、修正プログラムが既に3.2.7で利用できるようにし、それがシナリオSELinuxは=の施行に関連した以外にもありますに関する開かれたバグがあったことを知っています...

サポートしてください。

答えて

0

最近、同様の問題が発生しましたが、FC26で発生しました。ここでは、問題はSELINUX、特にカスタムdbPathディレクトリのアクセス権に引き継がれます。

多くのことをしようとした後、私は次のシーケンスは、私の問題を解決する助けたことがわかった:

MONGODB_DATADIR=/mnt/data 

sudo chown -R mongodb:mongodb $MONGODB_DATADIR 
sudo chmod -R 700 $MONGODB_DATADIR 

SELinuxの設定:

sudo semanage port -a -t mongod_port_t -p tcp 27017 

sudo semanage fcontext -a -t mongod_var_lib_t ${MONGODB_DATADIR} 
sudo semanage fcontext -a -t mongod_var_lib_t ${MONGODB_DATADIR}/mongod.lock 
sudo restorecon -v ${MONGODB_DATADIR} 

おそらく、また、カスタムログファイルの場所にmongod_log_tを追加する必要があります、/mnt/log/mongod.log、私は私の終わりにそれを修正しませんでした。

関連する問題