I use this mongodb server (MongoDB shell version v4.0.0) for several years, and now I can't connect to it.
Error: couldn't connect to server ******:27017, connection attempt failed: SocketException: Error connecting to *******:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:251:13 @(connect):1:6
exception: connect failed
I use this command to see status
sudo service mongod status
mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: Active: failed (Result: exit-code) since Wed 2021-10-27 23:35:15 UTC; 4min 28
Docs: https://docs.mongodb.org/manual Process: 11626 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exite Main PID: 11626 (code=exited, status=1/FAILURE)
I remove this file
sudo rm /var/lib/mongodb/mongod.lock
and I start mongodb but it's not work
I also removed this file
sudo rm -rf /tmp/mongodb-27017.sock
and it's not work