In a Linux machine, I changed the mongod.service
file to run a config file I created.
ExecStart=/usr/bin/mongod --config /etc/some_name.conf
When I start mongod with this config file manually, it runs fine. Yet when I use this config file to run the mongod daemon, it fails.
I did run systemctl daemon-reload
after the change, yet still failed.
Anybody also dealt with this issue?
Update
I've isolated the error in my log file to this line:
I STORAGE [initandlisten] exception in initAndListen: IllegalOperation:
Attempted to create a lock file on a read-only directory: /data/db, terminating
I CONTROL [initandlisten] now exiting
I've tried changing the ownership of the directory /data and /data/db to mongodb:mongodb but doesn't fix this error. Also changed the permissions to the directories with sudo chmod -R 775 /data
but still same error when I run:
sudo service mongod restart
sudo service mongod status
Status is still failed and same error in log file.
mongod
and which user account were you using? If you ran asroot
or a user different than that specified in the service definition (normallymongodb
), it is likely that you now have some mixed file or directory permissions in yourdbPath
which are preventing the service from starting. Check the log file specified in thesystemLog.path
in your/etc/some_name.conf
configuration: there should be some indication of why the service was unable to start. You could also check for consistent file & directory permissions in yourdbPath
.