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

152
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 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