I have installed mongo-10gen mongo-10gen-server on Linux CentOS server.
I followed the steps from Link.
I have configured /etc/mongod.conf as -
logpath=/var/log/mongo/mongod.log
port=27017
dbpath=/var/lib/mongo
I have set port 27017 for mongo in iptables. To start mongo I used commands -
service mongod start and
mongo
It get started well, but after few days I am getting the error -
Tue Jan 29 08:41:54 [initandlisten] ERROR: Insufficient free space for journal files
Tue Jan 29 08:41:54 [initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles
Tue Jan 29 08:41:54 [initandlisten]
Tue Jan 29 08:41:54 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
Tue Jan 29 08:41:54 dbexit:
Tue Jan 29 08:41:54 [initandlisten] shutdown: going to close listening sockets...
Tue Jan 29 08:41:54 [initandlisten] shutdown: going to flush diaglog...
Tue Jan 29 08:41:54 [initandlisten] shutdown: going to close sockets...
Tue Jan 29 08:41:54 [initandlisten] shutdown: waiting for fs preallocator...
Tue Jan 29 08:41:54 [initandlisten] shutdown: lock for final commit...
Tue Jan 29 08:41:54 [initandlisten] shutdown: final commit...
Tue Jan 29 08:41:54 [initandlisten] shutdown: closing all files...
Tue Jan 29 08:41:54 [initandlisten] closeAllFiles() finished
Tue Jan 29 08:41:54 [initandlisten] journalCleanup...
Tue Jan 29 08:41:54 [initandlisten] removeJournalFiles
Tue Jan 29 08:41:54 [initandlisten] shutdown: removing fs lock...
Tue Jan 29 08:41:54 dbexit: really exiting now
When I execute the command -
service mongod status
It gives Error -
mongod dead but subsys locked
Please help me to solve the problem of mongod dead but subsys locked and Insufficient free space for journals, terminating
You can add following to the config file provided when running
mongod --config mongod.conf
For MongoDB 3.x (latest version)
For version 2.6+
For version 2.4 and less
Then just execute mongod to accept your config file (here it assumes that location of the config is /etc/mongodb.conf):
Documentation for smallfiles parameter:
Just a note, which helped me. Though there were no technical issue related to mongo. It was just the system's space was insufficient. Clearing the system's cache worked out to me and mongo was back running smoothly.
Start
mongod
instance using following commandFor anyone having this issue despite having enough space for the journal file to be created.
My problem: I had more than enough space for the journal file to be created. Mongo gave me a connection failed issue. I used kill command to kill the mongod process which in turn gave me the subsys issue. Here is what worked for me:
Go to
/var/lock/subsys
and delete filemongod
now
service mongod stop
and thenservice mongod start
Started mongo shell now and everything seems to be running fine.
first
then
I was following the official guide at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
After using
I went to verify if MongoDB had started successfully by reviewing this log:
This is the problem that I found:
Solution:
At the end of the file /etc/mongod.conf I added this line:
After that, I restarted the mongod service:
Then when I went to review the log, I realized that everything was perfect, and the problem was fixed: