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

151
Visualizações
MongoDB data disappeared

I have MongoDB running in replication mode, with 3 instances, on AWS. The setup has been up and running for over a year. With periodic updates to the application server (running Node.js code). The application server has been running the same code for several months. Last night all calls to the DB started failing, when I logged in to the AWS EC2 Instance running the primary MongoDB, I could not find any of the collections from the mongo shell. This is the same mongo shell that's been up and running for months (I use tmux to connect).

Based on the size consumption on the filesystem, from what I remember, I think the data is there, but I'm not sure how to access it now.

sudo /usr/bin/mongod --replSet ReplicaSet --port 27017 --dbpath /data/db

The above command was used to start the mongo db, nothing has been changed, but the data simply disappeared last night. The same is true on all 3 servers (Primary and 2 Secondaries)

Any help is extremely welcomed...

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

See mongodb log if any dropDatabase command has been executed or not. Generally its /var/log/mongo/mongo.log. Or see /etc/mongo.conf for log file location.

Recently some exposed mongoDB has been hacked for ransom.

News is here

over 4 years ago · Santiago Trujillo Relatório

0

For debian/ubuntu

$ mongo
> use admin
> db.shutdownServer()

and then

mongod --fork --logpath /var/log/mongodb.log --dbpath /var/lib/mongodb
over 4 years ago · Santiago Trujillo Relatório

0

I imagine you solved this by now. I am going to give an answer for anyone with similar issues. I am not sure of your experience level with MongoDB, so I will try to layout more information than you probably need. Anyway,I have had a similar issue as you are experiencing. I love MongoDB, but it has a learning curve with it, mine was with what happens with "unconfined documents". If like me, you have MongoDB set to auto-restart in the event of a crash, then unless you check your logs, you may never be aware of a crash. If a crash occurs, or even a reset, there are times when documents that are there, but fall into the "unconfirmed" category are lost. So...

  1. One possible answer is to update MongoDB to a more current version. Some older ones I have come to understand have a larger problem with this.
  2. Understand "write concerns" and how they relate to data durability. An article that helped me a lot with this is:
    https://www.percona.com/blog/2016/07/14/mongodb-data-durability/

  3. Make sure conf file is being loaded. Perhaps it is not seeing your data for some reason. You can, for a test, load mongod.exe and specify the path directly to your db for a test, i.e.:

mongod --dbpath c:\mongo\data\db

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