0

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
5
  • 2
    Perhaps you need to set the right permissions on each directory leading to that path.
    – mustaccio
    Mar 1 at 15:49
  • Thank you @mustaccio! Mar 1 at 18:42
  • Maybe it is not so smart to store the data in your (personal) home directory. Usually mongod process runs as user mongodb 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. Mar 3 at 16:17
  • Thanks @WernfriedDomscheit. My /var/ directory has very little space. If you could tell me a workaround for moving some partition from my home folder to var folder, it would be really helpful. Any pointers would be greatly appreciated! Mar 6 at 17:20
  • Talk to your Linux admin to get more space Mar 6 at 19:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.