Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!