Background:
I have some AIO application machines, (running ubuntu with rails + mongodb + chromium) in one machine on a mobile coach for displaying information, occasionally user might change chuck in some data into mongodb.
Now, the power supply of the machine is constant, coach driver may power off the machine at any time. machine has 2 partition, first is aufs for /, the other is ext4 for mongodb /data directory. BUT during the instant of power cut, there is no data input into the db.
Problem:
Every time the machine is restarted due to power cut (every several hours), mongodb will leave a mongod.lock file in its directory. in /etc/rd.local I have tried to delete the lock file every boot up, but it sometimes still refuse to start. which causing my app fail the start.
According to official docs: http://www.mongodb.org/display/DOCS/Durability+and+Repair , I still have some occasion unable to start.
What's the best practice to run mongodb in a regular power failure situation like above? Without throwing additional hardware.