I’ve spent hours trying to get MongoDB to work.
My server was hacked after I reset the firewall and forgot to disable the port. After, Mongo wasn’t starting and I chose to reinstall. So I’ve tried to completely uninstall everything many times, and time after time it just doesn’t work!
When I try to install latest/6.0, it just fails to start with the error:
“mongod.service: Failed with result ‘core-dump’…”
“mongod.service Failed with result core-dump / Mongodb stop working: Aborted (core dumped)”
So alright, I looked up some guides and apparently that was an issue with versions 5.0+. So I installed 4.4.
Now, when starting I either get the error:
“mongod.service: Main process exited, code=exited, status=14/n/a”
But now, I’m just getting NO connection! I just cannot connect to it. Through localhost, externally (setting bind port to 0.0.0.0 & allowing firewall access to my ip), or any other way. Keep in mind, I’ve completely removed any SHRED of a trace of mongo from my machine with find, before reinstalling at least 7 times now.
I’m just about done, I cannot get a connection. ‘mongo’ just times out, every time. I’ve fiddled with the bindIp option in the setting then restarting the service, or even the machine to no success.
Starting mongodb (systemctl start mongod && systemctl status mongod):
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-10-03 19:47:05 EDT; 3s ago
Docs: https://docs.mongodb.org/manual
Main PID: 12681 (mongod)
Memory: 157.3M
CGroup: /system.slice/mongod.service
└─12681 /usr/bin/mongod --config /etc/mongod.conf
mongo:
MongoDB shell version v4.4.17
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection timed out :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
cat /var/log/mongodb/mongod.log:
Any help would be much appreciated!