0

We are running a mongo on single EC2 instance, we were not able to connect to it , upon debugging we saw CPU usage was spiking , this was the problem we faced previously we then restarted the instance and all connections were restored.

Now after two days same problem occurred, we tried to restart the instance and after that we found out our database is missing. Others database are as it is, only one got affected.

We saw mongo logs and it shows nothing about it , is there a way to find out what went wrong and to recover the data ?


Edit :

What O/S and version are you running?

Ubuntu 16 LTS

What is your version of MongoDB server and what security options have you enabled?

Mongo 3.4.9 , Security Password Protection

Was your instance restarted cleanly or did you force it to restart?

Clean Restart

Do you know what operations were running when the CPU was spiking?

Top Process Showed Mongod

Can you confirm whether there is a database missing (per the current description) or a collection (as per the current question title)?

A Database I think it had many collections now I can only see one

  • 1
    Have you checked the MongoDB logs and O/S logs both before and after restart? If there is definitely nothing interesting in the logs, the most likely path for data recovery is restoring from a recent backup. You could try providing some additional details in your question, but extended investigation is unlikely to be a good fit for the StackExchange Q&A format. You may also want to share a link to your log files or some log snippets in case there are missing details that might be meaningful. – Stennie Jan 12 at 22:53
  • Some questions that might provide clues: What O/S and version are you running? What is your version of MongoDB server and what security options have you enabled? Was your instance restarted cleanly or did you force it to restart? Do you know what operations were running when the CPU was spiking? Can you confirm whether there is a database missing (per the current description) or a collection (as per the current question title)? – Stennie Jan 12 at 22:55
  • Thank you for responding there was no backup , I have updated question as per request – Kush Vyas Jan 12 at 23:00
  • What is the name of the remaining collection you can see .. is it a collection that you created? Have you checked the contents of this collection? – Stennie Jan 12 at 23:03
  • 1
    Note: in future if CPU usage is spiking, I would suggest saving & reviewing db.currentOp() output from the mongo shell if possible. The CPU usage may have been expected due to index builds, aggregation queries, or other server-side processing. If the issue went away after a restart but reoccurred a few days later I'd suspect something related to a query or command that was running (since index builds should try to resume after restart). – Stennie Jan 12 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.