0

When I tried starting MongoDB service using "systemctl start mongodb " command nothing happens.

But when I use mongod command in terminal. The server starts so what should I do to start MongoDB as a service

The output result of mongod and mongo command are in the image link https://i.stack.imgur.com/jsGZT.png

I also tried to get the status before using mongod command using "systemctl status mongodb" command in the terminal and below is the output result

root@lc-1gb-blr1-01:~# systemctl status mongodb ● mongodb.service - High-performance, schema-free document-oriented database Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2019-07-01 10:49:50 UTC; 3h 49min ago Main PID: 8695 (code=exited, status=100)

Benoit
  • 5,118
  • 2
  • 24
  • 43
Anurag
  • 3
  • 3
  • According to the logs you posted, everything just starts perfectly. What is the problem when starting mongod ? – Benoit Jul 01 '19 at 14:17
  • @Benoit problem is mongodb not starting as a service. I have also added status info now – Anurag Jul 01 '19 at 14:51
  • Check list... You stopped mongod before launching the service ? The user that runs the service has the same rights as the one you use for direct launch of `mongod` ? Can you post the logs (usually under `/var/log/mongodb.log`) ? – Benoit Jul 01 '19 at 15:25
  • Thanks, @Benoit i checked log file and found this error "98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied" and solved the problem using this link https://stackoverflow.com/questions/15229412/unable-to-create-open-lock-file-data-mongod-lock-errno13-permission-denied – Anurag Jul 02 '19 at 06:52

0 Answers0