Recovering the MongoDB replicaset after a hard server reboot on 32bit systems

If one of your check servers crashes/was hard rebooted and it is running MongoDB you will most likely need to resync the MongoDB replicaset since the 32bit version of MongoDB doesn't use journaling.

First, check to see if your MongoDB instance needs to be resynced, tail the /var/log/mongo/mongod.log and if you see the following you will need to perform a resync.

e.g.

tail -n 100 /var/log/mongo/mongod.log

**************

Unclean shutdown detected.

Please visit http://dochub.mongodb.org/core/repair for recovery instructions.

*************

If you don't see a message about an unclean shutdown then your replica set is fine and doesn't need repaired.

If you do see this message, then ssh to the server that was rebooted and issue the following commands which backs up the existing replicaset data on that server, then removes it so it can be resynced. (If you have recovered this mongodb instance before you will need to use a different backup directory name instead of mongo-bk or remove the old mongo-bk before issuing the following commands).

mv /var/lib/mongo /var/lib/mongo-bk
mkdir /var/lib/mongo
cp /var/lib/mongo-bk/key /var/lib/mongo/.
chown mongod:mongod /var/lib/mongo
service mongod start

Upon starting up mongo, the replicaset will automatically be resynced.
  • 171 Users Found This Useful
Was this answer helpful?

Related Articles

Features in Development

ServerPing is always looking for ways to become even better, if you have any feature suggestions,...

Adding ServerPing to your Client Area template

You will need to provide a link to the SeverPing module from your client area. We recommend...

Using a custom module name/link for your client area

In order to access the client area of serverping from a custom module name, you will need to...

Getting Started with ServerPing

Monitoring your servers with ServerPing is quick and easy. Setting up your alert contacts...

Sample Custom Check Script

  /* Sample Custom Check   Upload this PHP script to your server to a directory that is...