the mongodb.lock file is a simple file which holds a random number and it is doing
most important tasks for MongoDB
Important of mongodb.lock file
1. To detect unexpected/ Unclean shutdown
2. dbpath only access by ONE mongod process
If you have seen any unexpected shutdown or hanged MongoDB server you have to repair your MongoDB before it starts.
Here are basic steps
1. look at the mongodb log file and see bottom lines of log. You will see some clue on mongod hanged
tail -n 20 /var/log/mongodb/mongodb.log
you may see below error message
"Detected unclean shutdown - mongod.lock is not empty."
2. Create a backup copy of the data files in the --dbpath.
mongodump --dbpath /data/mongodb/ -o /var
3. Start mongodb with --repair command
mongod --dbpath /data/db --repair
After the repair, the dbpath should contain the repaired data files and an empty mongod.lock file.
most important tasks for MongoDB
Important of mongodb.lock file
1. To detect unexpected/ Unclean shutdown
2. dbpath only access by ONE mongod process
If you have seen any unexpected shutdown or hanged MongoDB server you have to repair your MongoDB before it starts.
Here are basic steps
1. look at the mongodb log file and see bottom lines of log. You will see some clue on mongod hanged
tail -n 20 /var/log/mongodb/mongodb.log
you may see below error message
"Detected unclean shutdown - mongod.lock is not empty."
2. Create a backup copy of the data files in the --dbpath.
mongodump --dbpath /data/mongodb/ -o /var
3. Start mongodb with --repair command
mongod --dbpath /data/db --repair
After the repair, the dbpath should contain the repaired data files and an empty mongod.lock file.
No comments:
Post a Comment