i was using mongodb and it was fine.
then i wanted to convert it to replica set and i get into some problems and i uninstalled it.
after reinstalling (10 times and doing everything on internet xD) why i check status with systemctl status it say failed with exit_code ( i know my conf file dont have problem).
what can i do? i even installed the 3.3 version and even it doesnt start anymore.
i used anything that it came to my mind (purging config files & lot more...).
i really dont want to reinstall my os (really cant).
this is my sudo systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-02-18 20:05:20 +0330; 8s ago
Docs: https://docs.mongodb.org/manual
Process: 147513 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 147513 (code=exited, status=1/FAILURE)
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: Started MongoDB Database Server.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: about to fork child process, waiting until server is ready for connections.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147527]: forked process: 147527
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: ERROR: child process failed, exited with 1
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: To see additional information in this output, start without the "--fork" option.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: mongod.service: Failed with result 'exit-code'.
I solved the problem by changing the default mongodb port from port 27017 to port 27018 in /etc/mongod.conf.
I'm sure this will come handy to a lot of people.
And for the last part, after uninstalling mongodb I removed mongod.service files (every file) in the system and systemd directories in root and installed mongodb again.
(so I think uninstalling mongodb wasn't complete at first time. And 2 instances interfere with each other. Now everything works fine in mongodb with port 27018).
Related
I'm trying to use an external drive to store my mongo collections. As per this question, I changed dbPath in /etc/mongod.conf from /var/lib/mongodb to /media/user/drive/mongodb. I also chown'd the new path to the mongodb user.
However, when I sudo service start mongod, I cannot start the server:
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-12-07 22:27:09 CET; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 63819 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
Main PID: 63819 (code=exited, status=100)
Dec 07 22:27:09 user-ThinkPad-T480s systemd[1]: Started MongoDB Database Server.
Dec 07 22:27:09 user-ThinkPad-T480s systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
Dec 07 22:27:09 user-ThinkPad-T480s systemd[1]: mongod.service: Failed with result 'exit-code'.
When I change dbPath back to /var/lib/mongodb it starts again. How can I fix this such that I can use the path on my external drive?
Not sure which OS you run and which version of MongoDB.
On Amazon Linux 2 it's mongod user not mongodb for MongoDB-5.0
Make sure you ran chown with -R flag
-rw-r----- 1 mongod mongod 8.6M Dec 10 00:59 mongod.log
Also check logs for more hints, default location should be under
/var/log/mongodb/mongod.log
I currently have MongoDB 4.4 installed, as my system does not support 5.0. I have previously had 4.4 installed on Arch Linux, however when I moved over to Ubuntu and tried to run mongod, I get this result from systemd:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: signal) since Fri 2021-12-10 15:57:00 CST; 2min 3s ago
Docs: https://docs.mongodb.org/manual
Process: 4369 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=killed, signal=ILL)
Main PID: 4369 (code=killed, signal=ILL)
Dec 10 15:57:00 system systemd[1]: Started MongoDB Database Server.
Dec 10 15:57:00 system systemd[1]: mongod.service: Main process exited, code=killed, status=4/ILL
Dec 10 15:57:00 system systemd[1]: mongod.service: Failed with result 'signal'.
MongoDB fails before logs can be created.
While this doesn't completely solve the issue, I'm fine with this resolution:
For whatever reason, 4.2 works fine, but 4.4 doesn't, even though I was completely fine running 4.4 on Arch.
I installed MongoDB on the Ruspberry pi desktop on a VM, then I started it with the following command:
sudo service mongod start
The result of this command is the following:
systemctl list-unit-files --state enabled
mongodb.service enabled
Then when I check the status using
sudo service mongod status
The other issue is that there´s no .sock file in my /tmp folder.
PS: I removed MongoDB and reinstalled it trying to fix the issue but I always get the same problem.
Can anyone help me please?
Thank you in advance.
I get the following error:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-06-08 12:33:17 CEST; 3s ago
Docs: https://docs.mongodb.org/manual
Process: 22168 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=203/EXEC)
Main PID: 22168 (code=exited, status=203/EXEC)
Jun 08 12:33:17 raspberry systemd[1]: Started MongoDB Database Server.
Jun 08 12:33:17 raspberry systemd[22168]: mongod.service: Failed to execute command: Exec format error
Jun 08 12:33:17 raspberry systemd[22168]: mongod.service: Failed at step EXEC spawning /usr/bin/mongod: Exec format error
Jun 08 12:33:17 raspberry systemd[1]: mongod.service: Main process exited, code=exited, status=203/EXEC
Jun 08 12:33:17 raspberry systemd[1]: mongod.service: Failed with result 'exit-code'.```
When I set bindIp of mongod.conf file as my wifi router's default gateway i.e bindIp:127.0.0.1,198.168.3.1. my MongoDB server stops and I get following error when I check its status.
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset:
Active: failed (Result: exit-code) since Thu 2020-01-23 17:42:38 IST; 1s ago
Docs: https://docs.mongodb.org/manual
Process: 3046 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited
Main PID: 3046 (code=exited, status=48)
Jan 23 17:42:38 sarvahapc systemd[1]: Started MongoDB Database Server.
Jan 23 17:42:38 sarvahapc systemd[1]: mongod.service: Main process exited, code=
Jan 23 17:42:38 sarvahapc systemd[1]: mongod.service: Unit entered failed state.
Jan 23 17:42:38 sarvahapc systemd[1]: mongod.service: Failed with result 'exit-c
lines 1-11/11 (END)
But when I set bindIp: 0.0.0.0 in mongod.conf file my MongoDB server runs smoothly and it allows remote access to my MongoDB server for other systems which are in my wifi network.
I want to give remote access to my MongoDB server to other systems which are in my wifi network. Can anyone help me with this?
I am working on EC2 aws. My mongo suddenly stopped connecting.
sudo service mongodb status displays the following:-
● 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 Fri 2019-03-29 18:31:08 UTC; 1h 18min ago
Main PID: 3773 (code=exited, status=100)
Mar 29 18:31:07 ip-172-31-41-39 systemd[1]: Started An object/document-oriented database.
Mar 29 18:31:08 ip-172-31-41-39 systemd[1]: mongodb.service: Main process exited, code=exited, status=100/n/a
Mar 29 18:31:08 ip-172-31-41-39 systemd[1]: mongodb.service: Failed with result 'exit-code'.
I read that doing sudo service mongodb start might solve your problem but I fear will it delete my data?
An exit code 100 for the mongodb service means that it could not access or find the data directory. If your data directory is protected by sudo then starting the service with sudo will solve your problem.