Search code examples
node.jsmongodbpm2ubuntu-server

mongodb suddenly stopped working on production server


I have a server running node and mongoDB. Mongo is suddenly throwing errors, I managed to get it started upon rebooting the server but the error reappears upon trying to handle a request.

The error when I try to run mongo in a shell is:

MongoDB shell version v4.4.6
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 refused :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1

My mongod.conf has the correct data path and I also tried setting it manually using mongod --dbpath and can confirm that it is correct.

mongod --repair doesn't work either.

Any ideas?


Solution

  • Turns out the server was out of storage. Running df showed that there was no disk space left.

    I ended up adding a volume and moving my database and files there.