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?
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.