一、系统环境
os:阿里云ubuntu18.04 64位
mongodb 4.2 storageEngine:wiredTiger
二、ErrorMessage
1./lib/systemd/system/mongodb.service 文件不存在
Creating Systemd service file
https://github.com/droppanel/examples/blob/master/mongodb/ubuntu/install.default.sh
2./lib/systemd/system/mongodb.service is masked
sudo systemctl list-unit-files
UNIT FILE STATE
...
debian-fixup.service static
debug-shell.service disabled
display-manager.service enabled
dns-clean.service enabled
dsmcad.service enabled
emergency.service static
failsafe-x.service static
friendly-recovery.service masked
fuse.service masked
gdm.service masked
getty-static.service static
[email protected] enabled
gpsd.service indirect
[email protected] static
gpu-manager.service enabled
mongod.service enabled
mongodb.service masked
...
https://askubuntu.com/questions/710420/why-are-some-systemd-services-in-the-masked-state
error:
wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied Raw: [1530772324:204155][15656:0x7fb5cb734a00], wiredtiger_open: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied
2018-07-05T14:32:04.204+0800 E STORAGE [initandlisten] WiredTiger
2018-07-05T14:32:04.204+0800 E STORAGE [initandlisten] WiredTiger
run these command, the problem has been solved.
[sudo] chown mongodb.mongodb -R /var/lib/mongodb