I’ve bee following this tutorial to enable access control for MongoDB Community on my EC2 instance. Everything seems to go well until I run the db.adminCommand( { shutdown: 1 } )
from the instructions. I keep getting these error messages:
admin> db.adminCommand( { shutdown: 1 } )
Uncaught:
MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
Caused by:
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
Caused by:
Error: connect ECONNREFUSED 127.0.0.1:27017
This leaves me really confused because I have to run this command inside the mongo shell, so how can the connection suddenly be broken? If I try to exit using Ctrl+C and use mongosh
again, the same error appears: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
. I can’t use mongosh
with the new admin user I created either.
I’ve tried restarting the server over and over again, but the only thing that seems to work in running rm -f /tmp/mongodb-27017.sock
, but only temporarily.