Recovering MondoDB from an unclean shutdown

If MongoDB is refusing to start up and you see this message:

**************
 old lock file: \data\db\mongod.lock.  probably means unclean shutdown,
 but there are no journal files to recover.
 this is likely human error or filesystem corruption.
 found 1 dbs.
 see: http://dochub.mongodb.org/core/repair for more information
 *************

… see the instructions pointed to by the suggested URL.

Try starting up with the –repair option. When it completes, restart the server process as normal.

If you have the ‘probably means unclean shutdown’ message, remove the mongod.lock file by hand and then restart with –repair

Creating a Java SE Embedded 8 JRE using jrecreate.sh

Java SE 8 is the first Java release to incorporate JRE ‘profiles’, customized subsets of JRE libraries according to the needs of your app.

From the SE Embedded you need to create the JRE based on a selected profile and then copy it across to your device:

./bin/jrecreate.sh --help

to get a list of the options (more notes here).

To run the above on a Mac, you’ll need to set your JAVA_HOME first, assuming you already have an SE JDK installed. The Java install on Macs is different from other platforms, to handle having multiple versions installed. I have notes in a previous post on how to do this here.

Create a compact1 profile jre with:

./bin/jrecreate.sh --dest jre8 -p compact1

Zip the created dir with

zip -r jre8.zip jre8/*

Scp it over to your target device, unzip and you’re ready to go!