Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

282
Vistas
Mongodb connection error whenever rebooting server

I am using aws and installed ubuntu server on aws ec2. I installed mongodb on it. When installing mongodb, it is working well. But If i reboot server and try to connect mongod in termina. I am getting the following error.

MongoDB shell version v4.4.0 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:362:17 @(connect):2:6 exception: connect failed exiting with code 1

So whenever reboot server, i have to execute the following command and then mongo is working again. sudo systemctl stop mongod sudo rm /var/lib/mongodb/mongod.lock sudo mongod --repair --dbpath /var/lib/mongodb sudo mongod --fork --logpath /var/lib/mongodb/mongodb.log --dbpath /var/lib/mongodb sudo systemctl start mongod

I think whenever reboot server, executing above command does not make sense. If anyone have experienced, please help me. Thanks.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

After you setup the mongodb you usually would enable it, so that it starts after each reboot:

sudo systemctl enable mongod
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda