在/var/log/mongodb/mongod.log:中出现
Assertion: 28595:13: Permission denied src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
原来是使用root用户启动过mongdb,例如
sudo mongod -f /etc/mongod.conf ,
再用服务启动就不行了,
查看systemd的lib/systemd/system/mongodb.service
-
[Unit]
-
Description=MongoDB Database Service
-
Wants=network.target
-
After=network.target
-
-
-
[Service]
-
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
-
ExecReload=/bin/kill -HUP $MAINPID
-
Restart=always
-
User=mongodb
-
Group=mongodb
-
StandardOutput=syslog
-
StandardError=syslog
-
-
-
[Install]
-
WantedBy=multi-user.target
解决办法
-
# storage.dbPath sudo chown -R mongodb:mongodb /var/lib/mongodb
-
-
# systemLog.path sudo chown -R mongodb:mongodb /var/log/mongodb
-
-
如果想测试mongodb 配置文件是否正确,建议使用一下命令
-
sudo -u mongodb mongod -f /etc/mongod.conf
阅读(4181) | 评论(0) | 转发(0) |