Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

281
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda