I get this error after calling “sudo systemctl start mongod” ever since I crashed and had to reboot my ec2 instance on aws. Before that I had been running fine for about 6 month.
Since the reboot after trying to start Mongod as a service, when I check status of mongod it shows the following:
**×** mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongod.service; **enabled**; preset: **disabled**)
Active: **failed** (Result: exit-code) since Wed 2024-05-01 00:26:13 UTC; 6s ago
Duration: 1ms
Process: 106293 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf **(code=exited, status=217/USER)**
Main PID: 106293 (code=exited, status=217/USER)
CPU: 0
May 01 00:26:13 ip-172-31-29-18.us-west-1.compute.internal systemd[1]: Started mongod.service - High-performance, schema-free document-oriented database.
May 01 00:26:13 ip-172-31-29-18.us-west-1.compute.internal systemd[1]: **mongod.service: Main process exited, code=exited, status=217/USER**
May 01 00:26:13 ip-172-31-29-18.us-west-1.compute.internal systemd[1]: **mongod.service: Failed with result 'exit-code'.**
I’ve been through it with this problem. I first posted the issue on r/MongoDb on Reddit and tried a myriad of things from the few responses I got there.
I tried uninstalling MongodDB, deleting the mongod user, deleting /var/lib/mongo and var/logs/mongodb, and reinstalling, following the same tutorial I initially install on: “Install MongoDB Community Edition on Amazon Linux”
I’ve tried changing the ownership of every file involved with the service to mongod:
/etc/systemd/system/mongod.service
/var/lib/mongo
I found that I can get it running as a direct process, if I change /etc/passwd so the mongod user has /bin/true, and logging in as mongod and calling:
mongod -f /etc/mongod.conf
Then mongod runs as a process blocking the terminal and is functional for a short while. But I am unable to run it as a service with systemctl.
Please help! And if so inclined please check out the thread on reddit to see what all I’ve tried so far:
https://www.reddit.com/r/mongodb/comments/1c8p1dr/mongod_wont_start_after_instance_reboot/