I was following the official guide at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
After using
$sudo service mongod start
I went to verify if MongoDB had started successfully by reviewing this log:
/var/log/mongodb/mongod.log
This is the problem that I found:
2014-11-11T12:54:05.808-0500 [initandlisten] ERROR: Insufficient free space for journal files
2014-11-11T12:54:05.808-0500 [initandlisten] Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles
2014-11-11T12:54:05.808-0500 [initandlisten]
2014-11-11T12:54:05.808-0500 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2014-11-11T12:54:05.808-0500 [initandlisten] dbexit:
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: going to close listening sockets...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: going to flush diaglog...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: going to close sockets...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: waiting for fs preallocator...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: lock for final commit...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: final commit...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: closing all files...
2014-11-11T12:54:05.808-0500 [initandlisten] closeAllFiles() finished
2014-11-11T12:54:05.808-0500 [initandlisten] journalCleanup...
2014-11-11T12:54:05.808-0500 [initandlisten] removeJournalFiles
2014-11-11T12:54:05.814-0500 [initandlisten] shutdown: removing fs lock...
2014-11-11T12:54:05.814-0500 [initandlisten] dbexit: really exiting now
Solution:
At the end of the file /etc/mongod.conf I added this line:
smallfiles = true
After that, I restarted the mongod service:
$sudo service mongod restart
Then when I went to review the log, I realized that everything was perfect, and the problem was fixed:
2014-11-11T22:32:20.544-0500 ***** SERVER RESTARTED *****
2014-11-11T22:32:20.552-0500 [initandlisten] MongoDB starting : pid=5200 port=27017 dbpath=/var/lib/mongodb 64-bit host=jaimemontoya-VirtualBox
2014-11-11T22:32:20.552-0500 [initandlisten] db version v2.6.5
2014-11-11T22:32:20.552-0500 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
2014-11-11T22:32:20.552-0500 [initandlisten] build info: Linux build8.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-11-11T22:32:20.552-0500 [initandlisten] allocator: tcmalloc
2014-11-11T22:32:20.552-0500 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/var/lib/mongodb", smallFiles: true }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2014-11-11T22:32:20.564-0500 [initandlisten] journal dir=/var/lib/mongodb/journal
2014-11-11T22:32:20.564-0500 [initandlisten] recover : no journal files present, no recovery needed
2014-11-11T22:32:20.738-0500 [initandlisten] waiting for connections on port 27017
2014-11-11T22:33:20.748-0500 [clientcursormon] mem (MB) res:36 virt:245
2014-11-11T22:33:20.748-0500 [clientcursormon] mapped (incl journal view):64
2014-11-11T22:33:20.748-0500 [clientcursormon] connections:0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
jareware opened this issue
Jul 15, 2014
· 33 comments
Comments
I’m having trouble starting the image on Ubuntu:
$ uname -r
3.13.0-30-generic
$ cat /etc/issue
Ubuntu 14.04 LTS n l
…though it runs fine in a boot2docker
box for example.
$ docker run -d dockerfile/mongodb
76814a1501cc77df70283041143479a749a7ed9ffa46558e7dad00302374cdb8
$ docker logs 76814a1501cc77df70283041143479a749a7ed9ffa46558e7dad00302374cdb8
mongod --help for help and startup options
2014-07-15T12:59:41.035+0000 [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=76814a1501cc
2014-07-15T12:59:41.035+0000 [initandlisten] db version v2.6.1
2014-07-15T12:59:41.035+0000 [initandlisten] git version: 4b95b086d2374bdcfcdf2249272fb552c9c726e8
2014-07-15T12:59:41.035+0000 [initandlisten] build info: Linux build14.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-07-15T12:59:41.035+0000 [initandlisten] allocator: tcmalloc
2014-07-15T12:59:41.036+0000 [initandlisten] options: {}
2014-07-15T12:59:41.089+0000 [initandlisten] journal dir=/data/db/journal
2014-07-15T12:59:41.089+0000 [initandlisten] recover : no journal files present, no recovery needed
2014-07-15T12:59:41.089+0000 [initandlisten]
2014-07-15T12:59:41.089+0000 [initandlisten] ERROR: Insufficient free space for journal files
2014-07-15T12:59:41.089+0000 [initandlisten] Please make at least 3379MB available in /data/db/journal or use --smallfiles
2014-07-15T12:59:41.090+0000 [initandlisten]
2014-07-15T12:59:41.090+0000 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2014-07-15T12:59:41.090+0000 [initandlisten] dbexit:
2014-07-15T12:59:41.090+0000 [initandlisten] shutdown: going to close listening sockets...
2014-07-15T12:59:41.090+0000 [initandlisten] shutdown: going to flush diaglog...
2014-07-15T12:59:41.091+0000 [initandlisten] shutdown: going to close sockets...
2014-07-15T12:59:41.091+0000 [initandlisten] shutdown: waiting for fs preallocator...
2014-07-15T12:59:41.091+0000 [initandlisten] shutdown: lock for final commit...
2014-07-15T12:59:41.091+0000 [initandlisten] shutdown: final commit...
2014-07-15T12:59:41.091+0000 [initandlisten] shutdown: closing all files...
2014-07-15T12:59:41.091+0000 [initandlisten] closeAllFiles() finished
2014-07-15T12:59:41.091+0000 [initandlisten] journalCleanup...
2014-07-15T12:59:41.092+0000 [initandlisten] removeJournalFiles
2014-07-15T12:59:41.122+0000 [initandlisten] shutdown: removing fs lock...
2014-07-15T12:59:41.122+0000 [initandlisten] dbexit: really exiting now
Any ideas? I was under the impression the default container virtual size limit was around 10 GB, though I’m having a hard time finding a source for that…
Changing the CMD
to CMD ["mongod", "--smallfiles"]
fixes the issue, but would be nice to understand what’s causing the inconsistency depending on the host.
@jareware instead of modifying the docker file you can run the container this way
docker run -d -p 27017:27017 --name test-mongo mongo mongod --smallfiles
I still don’t understand why you need smallfiles. So, I’d vote for re-opening the issue.
I’m fairly certain my issue was caused by using boot2docker, which is surprising given the OP.
Basically, -v
is mapping to a directory in the boot2docker-vm, which does not in fact have much space available.
A message that would have saved me some confusion would have been to print out a slightly more informative message with the approximate free space available.
I increased my boot2docker hard drive to 60GB, and have no problem running this command dd if=/dev/zero of=sample_big_file.txt bs=1 count=1 se ek=5000000000
(creating 5G) on the boot2docker machine. But if I run a bash inside the mongo, then:
Wed Oct 22 10:56:18.229 [initandlisten] journal dir=/data/db/journal
Wed Oct 22 10:56:18.229 [initandlisten] recover : no journal files present, no recovery needed
Wed Oct 22 10:56:18.230 [initandlisten]
Wed Oct 22 10:56:18.230 [initandlisten] ERROR: Insufficient free space for journal files
Wed Oct 22 10:56:18.230 [initandlisten] Please make at least 3379MB available in /data/db/journal or use --smallfiles
$ df -h
rootfs 57G 20G 35G 37% /
none 57G 20G 35G 37% /
tmpfs 1005M 0 1005M 0% /dev
shm 64M 0 64M 0% /dev/shm
/dev/sda1 57G 20G 35G 37% /etc/resolv.conf
/dev/sda1 57G 20G 35G 37% /etc/hostname
/dev/sda1 57G 20G 35G 37% /etc/hosts
tmpfs 1.8G 240M 1.6G 14% /data/db
tmpfs 1005M 0 1005M 0% /proc/kcore
$ ls -l /data/db/journal/
total 4
-rw-r--r-- 1 mongodb root 5000000001 Oct 22 10:55 sample_big_file.txt
Apparently docker is imposing some incorrect limit on the /data/db
folder?
I am getting the same error — it worked for me multiple times to run the container and now all off the sudden it decided to throw me this error without any apparent reason.
Is anyone finding a proper solution for this, that does not require smallfiles?
Happens also to me, with OS X and boot2docker 1.3.1. and --smallfiles
doesn’t solve the issue.
Command-line is:
docker run -d --name mongo-server -p 27017:27017 -v /data/mongodb/db:/data/db mongo-image mongod --smallfiles --replSet rs0
And I get the error:
2014-11-06T09:34:38.480+0000 [initandlisten] ERROR: Insufficient free space for journal files
2014-11-06T09:34:38.480+0000 [initandlisten] Please make at least 3379MB available in /data/db/journal or use --smallfiles
2014-11-06T09:34:38.480+0000 [initandlisten]
2014-11-06T09:34:38.483+0000 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
And:
docker@boot2docker:~$ df -h
Filesystem Size Used Available Use% Mounted on
rootfs 1.8G 204.6M 1.6G 11% /
tmpfs 1.8G 204.6M 1.6G 11% /
tmpfs 1004.2M 0 1004.2M 0% /dev/shm
/dev/sda1 32.6G 4.2G 26.7G 14% /mnt/sda1
cgroup 1004.2M 0 1004.2M 0% /sys/fs/cgroup
none 233.0G 126.6G 106.3G 54% /Users
/dev/sda1 32.6G 4.2G 26.7G 14% /mnt/sda1/var/lib/docker/devicemapper```
UPDATE:
If I mount the directory to /data/mongo/db
, it errs, because it’s only 1.8GB in size. If I mount it to /mnt/sda1/data/mongo/db
, it works. This is a mount point that was created automatically because I added to boot2docker’s config the line DiskSize = 35000
.
So the solution for me was to set /mnt/sda1 as the volume for my docker volumes.
this is my fig yml right now:
db:
image: mongo:latest
ports:
- «27017:27017»
what should be the content of command??
db:
image: mongo:latest
ports:
- «27017:27017»
commands: —smallfiles
Is this correct?
@bicccio remove the s in commands
P.S. this is an ongoing issue that should probably get a fix. Shouldn’t have to be using —smallfiles
I mounted a directory from the host ex. /host/data
to the container to solve the issue:
docker run -v /host/data:/data/db mongo
I have the same problem in AWS EC2 with Amazon Linux. Even though I mounted a directory from the host as suggested by @eloone it doesn’t work.
/data/db
in my host is a mountpoint where I mounted a 50GB EBS disk.
Then I run docker run --name mongo -d -v /data/db:/data/db mongo
but the error is the same, moreover if I run
docker run --name some-mongo -d -v /data/db:/data/db mongo df -h
I get
/dev/xvda1 7.8G 6.0G 1.8G 78% /data/db
The same behaviour if I use a data volume container. Actually I don’t want to use --smallfiles
, what is the right way to run a dockerized mongo in a production environment with data volume container avoiding space problems?
Have the same problem with aws ec2, any update on this?
h12w
pushed a commit
to h12w/gspec
that referenced
this issue
May 15, 2015
Destroy and recreate the boot2docker VM and pull mongo:latest again, the issue disappears for now.
boot2docker destroy
boot2docker init
Still now fix for this? I have to resort to destroying and recreating my VM like @HaiLiang mentions, but after a while it happens again.
—smallfiles didn’t work either
I’m getting this on my Linux Fedora installation now.
I just updated to docker-1.7.0-6.git74e7a7a.fc22.x86_64 which caused me to have to wipe out /var/lib/docker and set up some docker-storage like this:
$ cat /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS=-s devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=/dev/mapper/vg_ksylvan--t420-docker--pool --storage-opt dm.use_deferred_removal=true
And
docker run --name=mongo -it docker.io/mongo
Worked, many many times, but now it does not. «docker images» only shows 2 image (docker.io/node and docker.io/mongo) and «docker ps -a» only shows the named mongo container, which is not starting up:
2015-07-15T22:28:35.892+0000 I JOURNAL [initandlisten]
2015-07-15T22:28:35.892+0000 E JOURNAL [initandlisten] Insufficient free space for journal files
2015-07-15T22:28:35.892+0000 I JOURNAL [initandlisten] Please make at least 3379MB available in /data/db/journal or use --smallfiles
2015-07-15T22:28:35.892+0000 I JOURNAL [initandlisten]
Any clues?
And docker info shows this:
$ docker info
Containers: 1
Images: 27
Storage Driver: devicemapper
Pool Name: vg_ksylvan--t420-docker--pool
Pool Blocksize: 524.3 kB
Backing Filesystem: extfs
Data file:
Metadata file:
Data Space Used: 1.475 GB
Data Space Total: 53.59 GB
Data Space Available: 52.11 GB
Metadata Space Used: 548.9 kB
Metadata Space Total: 469.8 MB
Metadata Space Available: 469.2 MB
Udev Sync Supported: true
Deferred Removal Enabled: true
Library Version: 1.02.93 (2015-01-30)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.7-300.fc22.x86_64
Operating System: Fedora 22 (Twenty Two)
CPUs: 4
Total Memory: 15.56 GiB
Name: ksylvan-t420
ID: I4KU:N3YC:52JU:DBB3:QF5H:CFHH:Y547:VCDO:EEDD:XBW5:JIY6:IUCG
Username: kayvan
Registry: https://index.docker.io/v1/
Any help would be greatly appreciated.
@jareware Running into the same issue on OS X with boot2docker and official mongo image
I have issues with mongodb image using Docker Machine with VirtualBox VM, using small files setting. Makes no difference.
Cleaning up tagged images (#51) to create more space might be a band-aid, but it doesn’t explain root cause.
Hi Guys am experiencing almost a similar problem. I really need a quick solution to this. I have dockerized mongodb and meteor and my mongodb image is 309mb but my container is increasing size with a 1 gig everyday. Hoe can i overcome this problem?
For me the problem was that I shut down my computer without shutting down the container properly.
When starting the container an internal problem happened with the mongo. I SSH’ed into the machine and deleted a lock file and then the container started all right for me.
My solution was to create a new docker-machine, with 30gb instead of 20gb
I’m having the same issue on OSX, Docker Version 1.12.3-beta29.3 (13640), and tutum/mongodb, for what it’s worth. The error on docker-compose up was:
db_1 … ERROR: Insufficient free space for journal files
db_1 … Please make at least 3379MB available in /data/db/journal or use —smallfiles
Since I’m using the new(ish) Docker app, instead of the old approach, it’s a little unclear at first glance how I’ll do the rebuild workaround, and restarting the Docker app isn’t helping.
update: posting this in docker-library/mongo#51 ; please advise if this was not the right thing to do.
Cleaning up my Docker data with these instructions fixed the issue, particularly removing unnecessary volumes.
It seems the problem is only present in the 3.0 version of MongoDB. Switching to a 3.1 or later version corrects the problem.
If someone stumbles on this issue more recently: Note that since mongo 3.2 the default storage engine is wiredTiger, which does not have smallfiles config, but it seems, as noted above, that mongo version 3.1+ solves the problem anyway.
chao-xian
added a commit
to alphagov/govuk-docker
that referenced
this issue
Mar 10, 2020
Seeing persistent errors that there's not enough space. This is a common issue in MongoDB prior to 3.0[1]. Setting the --smallfiles flag addressed the problem. [1]: dockerfile/mongodb#9
I have installed a standalone mongo 2.6 in amazon ec2. The instance has reach the limit of disk space and it doesnt run now. I have set before the smallfiles=true in mongod.conf file, but for some reason this doesn’t work neither.
The log file says:
2015-03-12T19:41:26.881+0000 [initandlisten] ERROR: Insufficient free space for journal files
2015-03-12T19:41:26.881+0000 [initandlisten] Please make at least 422MB available in /data/journal or use —smallfiles
2015-03-12T19:41:26.881+0000 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
I tried to set journal path in another volume >
sudo ln -s /journal /data/journal
But this doesn’t work neither and logs the same error above
I want to mantain the /data (with all dbs files) in the same disk , I only want to move the journal path to another disk , is that possible?
Please , any help is welcome!
pd: I used before tune2fs for get more space , but now I don’t have it.
While managing MongoDB, it’s very common to see Error: couldn’t connect to server 127.0.0.1:27017.
It’s loud and clear that Mongo shell couldn’t speak to the MongoDB server.
And the reasons for the error can be incorrect MongoDB settings, firewall restrictions and many more.
At Bobcares, we often get requests to fix MongoDB port 27017 not working error as part of our Server Management Services.
Today, let’s get into the details and see how our Support Engineers fix MongoDB port errors.
How we fix common MongoDB port errors
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face problems while managing MongoDB.
Now let’s see the major reasons for MongoDB errors and how our Support Engineers fix the top errors.
1. Incorrect IP or port
Recently, one of our customers contacted us with a problem related to MongoDB port connection. When the customer tried to restart the MongoDB, he was getting an error like,
mongo
MongoDB shell version: 2.2.1
connecting to: test
Fri Nov 9 16:44:06 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
Moreover, an attempt to access MongoDB tool resulted in the error:
In general, this happens when the address like host or IP was wrong or that it is not running on the server.
Therefore, our Database Engineers edited /etc/mongodb.conf and corrected the settings. We updated the bind IP of the MongoDB to accept connection from outside and also confirmed that the port 27017 is open.
That fixed the problem and MongoDB started accepting connections.
2. Insufficient storage space
Similarly, another customer had the same error, mongo MongoDB shell version: 2.4.9 connecting to: test Sun May 8 22:10:15.641 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed
while restarting the MongoDB.
Looking into the MongoDB log file, located in /var/log/mongodb/mongodb.log, we found the reason as
ERROR: Insufficient free space for journal files
Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles
This error occurs when the space allocated to disk is insufficient to store the journal files. Also, the journal allocation is required to store a minimum of 3 GB space to create and store journal files.
So, our Support Engineers solved the error by executing these steps.
We opened the startup file at /etc/init.d/mongod and changed from
daemon –user “$MONGO_USER” $NUMACTL $mongod $OPTIONS –nounixsocket
to
daemon –user “$MONGO_USER” $NUMACTL $mongod $OPTIONS –nounixsocket –smallfiles
3. Problem with mongod service
Normally this error caused when didn’t start the mongod process before start mongo shell. So, our Support Engineers used the following steps to solve the error.
1. Initially, we removed the .lock file by executing
rm /var/lib/mongodb/mongod.lock
2. Then, we repaired the MongoDB
mongod –repair
3. After that, we started the mongod server
service mongod start
4. Finally, we started the mongo client
mongo
That’s it.
[Need assistance to fix MongoDB port errors? We’ll help you.]
Conclusion
In short, MongoDB port 27017 not working error may happen when there is insufficient storage space for journal files on disk or incorrect settings in the mongodb.conf file, firewall restrictions, etc. Today, we saw the various reasons for MongoDB port errors and how our Support Engineers fix them.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
Post Views: 25,269
Mongodb: Actual error is “Insufficient free space for journal files“.
Before discussing about the error, I will give you a short information about Mongodb. Mongodb is a free and open source software for platform document-oriented database.
A document-oriented database is a computer program designed for storing, retrieving, and managing document-oriented information. It also known as semi-structured data.
Here I got this error after successfully completing the installation process of MongoDB on a VPS. And finally found a solution. I like to share the steps I did to fix this error.
After complete the installation successfully, the ‘Mongodb’ shows some error with its restart. The error details are pasted below:
Starting mongod: about to fork child process, waiting until server is ready for connections.
ERROR: child process failed, exited with error number 100
Example:
[[email protected] ]# service mongod restart
Stopping mongod: [FAILED]
Starting mongod: about to fork child process, waiting until server is ready for connections.
forked process: 15602
all output going to: /var/log/mongo/mongod.log
ERROR: child process failed, exited with error number 100
[FAILED]
[[email protected] ]#
Log file details
[[email protected] ]# tailf /var/log/mongo/mongod.log
"ERROR: Insufficient free space for journal files"
Solution
Ist Step: At first, you need to run the follwing command before editing the configuration file(/etc/mongod.conf).
[[email protected] ]# mongod --smallfiles
IIInd Step: Change/Add/uncomment the value for the directive ‘nojournal’ in the configuration file(/etc/mongod.conf) to true
vi /etc/mongod.conf
-----
nojournal = true
-----
IIIrd Step: Save and restart the service:
[[email protected] ]# service mongod restart
That’s all.
Some interesting topics on Mongo
Dump Mongo DB and move it to an S3 bucket.
- This includes the steps to dump Mongo DB.
- AWS cli command to move to S3 bucket.
- A simple bash script for automation purpose.
Dump Mongo DB collections and move it to an S3 bucket.
- This includes the steps to dump Mongo DB collections.
- AWS cli command to move to S3 bucket.
- A simple bash script for automation purpose.
Я следил за официальным руководством по http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
После использования
$sudo service mongod start
Я пошел проверить, успешно ли MongoDB, просмотрев этот журнал:
/var/log/mongodb/mongod.log
Это проблема, которую я нашел:
2014-11-11T12:54:05.808-0500 [initandlisten] ERROR: Insufficient free space for journal files
2014-11-11T12:54:05.808-0500 [initandlisten] Please make at least 3379MB available in /var/lib/mongodb/journal or use --smallfiles
2014-11-11T12:54:05.808-0500 [initandlisten]
2014-11-11T12:54:05.808-0500 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2014-11-11T12:54:05.808-0500 [initandlisten] dbexit:
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: going to close listening sockets...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: going to flush diaglog...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: going to close sockets...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: waiting for fs preallocator...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: lock for final commit...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: final commit...
2014-11-11T12:54:05.808-0500 [initandlisten] shutdown: closing all files...
2014-11-11T12:54:05.808-0500 [initandlisten] closeAllFiles() finished
2014-11-11T12:54:05.808-0500 [initandlisten] journalCleanup...
2014-11-11T12:54:05.808-0500 [initandlisten] removeJournalFiles
2014-11-11T12:54:05.814-0500 [initandlisten] shutdown: removing fs lock...
2014-11-11T12:54:05.814-0500 [initandlisten] dbexit: really exiting now
Решение:
В конце файла /etc/mongod.conf я добавил эту строку:
smallfiles = true
После этого я перезапустил службу mongod:
$sudo service mongod restart
Затем, когда я пошел на просмотр журнала, я понял, что все было идеально, и проблема была исправлена:
2014-11-11T22:32:20.544-0500 ***** SERVER RESTARTED *****
2014-11-11T22:32:20.552-0500 [initandlisten] MongoDB starting : pid=5200 port=27017 dbpath=/var/lib/mongodb 64-bit host=jaimemontoya-VirtualBox
2014-11-11T22:32:20.552-0500 [initandlisten] db version v2.6.5
2014-11-11T22:32:20.552-0500 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
2014-11-11T22:32:20.552-0500 [initandlisten] build info: Linux build8.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-11-11T22:32:20.552-0500 [initandlisten] allocator: tcmalloc
2014-11-11T22:32:20.552-0500 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/var/lib/mongodb", smallFiles: true }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2014-11-11T22:32:20.564-0500 [initandlisten] journal dir=/var/lib/mongodb/journal
2014-11-11T22:32:20.564-0500 [initandlisten] recover : no journal files present, no recovery needed
2014-11-11T22:32:20.738-0500 [initandlisten] waiting for connections on port 27017
2014-11-11T22:33:20.748-0500 [clientcursormon] mem (MB) res:36 virt:245
2014-11-11T22:33:20.748-0500 [clientcursormon] mapped (incl journal view):64
2014-11-11T22:33:20.748-0500 [clientcursormon] connections:0
MongoDB Failed to startup due to : Insufficient free space for journal files
Here is log :-
[root@ac-00066047 data]# service mongod start
Starting mongod: Wed Dec 9 03:36:16.078 [initandlisten] MongoDB starting : pid=30893 port=27017 dbpath=/data/db/ 64-bit host=ac-00066047
Wed Dec 9 03:36:16.078 [initandlisten] db version v2.4.14
Wed Dec 9 03:36:16.078 [initandlisten] git version: 05bebf9ab15511a71bfbded684bb226014c0a553
Wed Dec 9 03:36:16.078 [initandlisten] build info: Linux ip-10-154-253-119 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Wed Dec 9 03:36:16.078 [initandlisten] allocator: tcmalloc
Wed Dec 9 03:36:16.078 [initandlisten] options: { auth: “true”, bind_ip: “127.0.0.1”, config: “/etc/mongod.conf”, nounixsocket: true, port: 27017, quiet: “true” }
Wed Dec 9 03:36:16.098 [initandlisten] journal dir=/data/db/journal
Wed Dec 9 03:36:16.098 [initandlisten] recover : no journal files present, no recovery needed
Wed Dec 9 03:36:16.098 [initandlisten]
Wed Dec 9 03:36:16.098 [initandlisten] ERROR: Insufficient free space for journal files
Wed Dec 9 03:36:16.098 [initandlisten] Please make at least 3379MB available in /data/db/journal or use –smallfiles
Wed Dec 9 03:36:16.098 [initandlisten]
Wed Dec 9 03:36:16.098 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
Wed Dec 9 03:36:16.098 dbexit:
Wed Dec 9 03:36:16.098 [initandlisten] shutdown: going to close listening sockets…
Wed Dec 9 03:36:16.098 [initandlisten] shutdown: going to flush diaglog…
Wed Dec 9 03:36:16.098 [initandlisten] shutdown: going to close sockets…
Wed Dec 9 03:36:16.098 [initandlisten] shutdown: waiting for fs preallocator…
Wed Dec 9 03:36:16.098 [initandlisten] shutdown: lock for final commit…
Wed Dec 9 03:36:16.098 [initandlisten] shutdown: final commit…
Wed Dec 9 03:36:16.098 [initandlisten] shutdown: closing all files…
Wed Dec 9 03:36:16.098 [initandlisten] closeAllFiles() finished
Wed Dec 9 03:36:16.098 [initandlisten] journalCleanup…
Wed Dec 9 03:36:16.098 [initandlisten] removeJournalFiles
Wed Dec 9 03:36:16.100 [initandlisten] shutdown: removing fs lock…
Wed Dec 9 03:36:16.100 dbexit: really exiting now
[FAILED]
This issue to due to space allocated to disk in sufficient to store the journal files on disk. > journal allocation is required to store minimum 3 GB space to create and store journal files.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
8.9G 7.4G 1.2G 87% /
[root@ac-00066047 data]#
Fix:
smallfiles
Default: false
Set to true to modify MongoDB to use a smaller default data file size. Specifically, smallfiles reduces the initial size for data files and limits them to 512 megabytes. The smallfiles setting also reduces the size of each journal files from 1 gigabyte to 128 megabytes.
Use the smallfiles setting if you have a large number of databases that each hold a small quantity of data. The smallfiles setting can lead mongod to create many files, which may affect performance for larger databases.
adding following –smallfiles parameter to mongod startup file
/etc/init.d/mongod
daemon –user “$MONGO_USER” $NUMACTL $mongod $OPTIONS –nounixsocket
to
daemon –user “$MONGO_USER” $NUMACTL $mongod $OPTIONS –nounixsocket –smallfiles
[root@ac-00066047 data]# service mongod start
Starting mongod: Wed Dec 9 03:55:34.383 [initandlisten] MongoDB starting : pid=31098 port=27017 dbpath=/data/db/ 64-bit host=ac-00066047
Wed Dec 9 03:55:34.383 [initandlisten] db version v2.4.14
Wed Dec 9 03:55:34.383 [initandlisten] git version: 05bebf9ab15511a71bfbded684bb226014c0a553
Wed Dec 9 03:55:34.383 [initandlisten] build info: Linux ip-10-154-253-119 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Wed Dec 9 03:55:34.383 [initandlisten] allocator: tcmalloc
Wed Dec 9 03:55:34.383 [initandlisten] options: { auth: “true”, bind_ip: “127.0.0.1”, config: “/etc/mongod.conf”, journal: “true”, logappend: “true”, nounixsocket: true, port: 27017, quiet: “true”, smallfiles: true }
Wed Dec 9 03:55:34.400 [initandlisten] journal dir=/data/db/journal
Wed Dec 9 03:55:34.400 [initandlisten] recover : no journal files present, no recovery needed
Wed Dec 9 03:55:34.590 [initandlisten] waiting for connections on port 27017
Wed Dec 9 03:55:34.590 [websvr] admin web console waiting for connections on port 28017
Verify that mongod service has been started sucessfully
[root@ac-00066047 data]# service mongod status
mongod (pid 31098) is running…
[root@ac-00066047 data]#