I specified a different directory for my mongodb data in the mongodb conf file:
# Where and how to store data.
storage:
dbPath: /home/psr/data/mongodb
# engine:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
I keep getting the following error:
{"t":{"$date":"2024-03-01T09:14:42.914-06:00"},"s":"E", "c":"CONTROL", "id":20557, "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"Location28596: Unable to determine status of lock file in the data directory /home/psr/data/mongodb: boost::filesystem::status: Permission denied [system:13]: \"/home/psr/data/mongodb/mongod.lock\""}}
Here are the permissions of the old and the new lock files:
OLD:
-rw---x--- 1 mongodb mongodb 0 Mar 1 08:31 /var/lib/mongodb/mongod.lock
NEW:
-rwxrwxrwx 1 mongodb mongodb 0 Mar 1 08:53 data/mongodb/mongod.lock
mongod
process runs as usermongodb
which by default has no access to your home directory. Better use a generic folder, e.g./var/lib/mongodb/
- looks like you did this, but you played around with different folders.