High idle CPU usage for MongoDB on Ubuntu guest VM - mongodb

I'm running an Ubuntu 12.04 server instance on VirtualBox on a OS X 10.7 host (MacBook Air 13"). The instance is configured with 512mb ram. The disk image is set to 8GB (dynamically allocated if that makes any difference) and is using 2.6GB.
I've just installed MongoDB from the 10gen repo as described here: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/
I haven't changed any of the default settings as yet.
The mongod process is now running at 15-20% cpu constantly, before I've connected anything to it. I wouldn't normally have checked but it's now causing the fans to stay on whenever the VM is running.
Restarting mongodb makes no difference. Restarting the VM makes no difference.
The log is as follows:
Thu Jun 21 16:52:14 [initandlisten] MongoDB starting : pid=1737 port=27017 dbpath=/var/lib/mongodb 64-bit host=devbox
Thu Jun 21 16:52:14 [initandlisten] db version v2.0.6, pdfile version 4.5
Thu Jun 21 16:52:14 [initandlisten] git version: e1c0cbc25863f6356aa4e31375add7bb49fb05bc
Thu Jun 21 16:52:14 [initandlisten] build info: Linux ip-10-110-9-236 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_41
Thu Jun 21 16:52:14 [initandlisten] options: { config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Thu Jun 21 16:52:14 [initandlisten] journal dir=/var/lib/mongodb/journal
Thu Jun 21 16:52:14 [initandlisten] recover : no journal files present, no recovery needed
Thu Jun 21 16:52:14 [initandlisten] waiting for connections on port 27017
Thu Jun 21 16:52:14 [websvr] admin web console waiting for connections on port 28017
I'm assuming 15-20% cpu usage at idle isn't normal, so I'd like to know if anyone has any suggestions on what to try to fix it?
edit
I've now converted the disk image to a fixed size VDI and it's made no difference, still at 15-20% CPU usage on the guest.

This is a bug in VirtualBox on OSX as far as I can tell, I switched to Parallels and haven't had an issue since.

Related

MongoDB Illegal Instruction

When I type in "mongo" in terminal
it cannot run and shows up these thing
MongoDB shell version: 2.4.9
Illegal instruction (core dumped)
then nothing happen.
I install mongodb in arch linux.
I have create /data/db.
What kind of processor is this running on? There have been issues in the past with unimplemented instructions on some older processor architectures.
Can you use gdb to examine the core file, or start the mongo process under gdb and reproduce the problem, and determine
what is the illegal instruction that is being executed?
what is the stack backtrace at the point where the illegal instruction occurs?
have you started mongod --dbpath "db location" first? – Eugene P yesterday
Did you get MongoDB from your system package manager or somewhere else? – sudo_O yesterday
This sounds like corruption, new versions of the mongo shell should produce another error if the MongoDB server isn't reachable. – Sammaye yesterday
I have used mongod --dbpath /data/db.
I get mongodb from pacakge manager, i have tried to compile from source, it also same.
mongod --dbpath /data/db
Tue Feb 25 13:27:46.024
Tue Feb 25 13:27:46.027 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Tue Feb 25 13:27:46.032
Tue Feb 25 13:27:46.128 [initandlisten] MongoDB starting : pid=23705 port=27017 dbpath=/data/db 32-bit host=xeraph.hk
Tue Feb 25 13:27:46.129 [initandlisten]
Tue Feb 25 13:27:46.131 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary .
Tue Feb 25 13:27:46.133 [initandlisten] ** 32 bit builds are limited to le ss than 2GB of data (or less with --journal).
Tue Feb 25 13:27:46.134 [initandlisten] ** Note that journaling defaults t o off for 32 bit and is currently off.
Tue Feb 25 13:27:46.136 [initandlisten] ** See http://dochub.mongodb.org/c ore/32bit
Tue Feb 25 13:27:46.138 [initandlisten]
Tue Feb 25 13:27:46.139 [initandlisten] db version v2.4.9
Tue Feb 25 13:27:46.140 [initandlisten] git version: nogitversion
Tue Feb 25 13:27:46.141 [initandlisten] build info: Linux root-armv6-copy 3.4.76 -1-ARCH #1 SMP PREEMPT Wed Jan 15 15:31:14 MST 2014 armv7l BOOST_LIB_VERSION=1_5 5
Tue Feb 25 13:27:46.141 [initandlisten] allocator: system
Tue Feb 25 13:27:46.142 [initandlisten] options: { dbpath: "/data/db" }
Tue Feb 25 13:27:46.227 [websvr] admin web console waiting for connections on po rt 28017
Tue Feb 25 13:27:46.228 [initandlisten] waiting for connections on port 27017
The terminal pause there, then i login to another ssh terminal,
mongo
Also illegal instruction.

New to MongoDB: Can't get into mongo shell

I've just installed MongoDB via Homebrew, and I'm trying to get it up and running. I've launched it using mongodin the command line, and now I'm trying to get into the shell by using the command mongo once it is running. However, nothing happens when I run the command. Here is a paste of my log:
Fri Sep 6 16:54:02.458 [initandlisten] MongoDB starting : pid=17731 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=lsadmin’s-MacBook-Pro
Fri Sep 6 16:54:02.458 [initandlisten]
Fri Sep 6 16:54:02.458 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Fri Sep 6 16:54:02.458 [initandlisten] db version v2.4.6
Fri Sep 6 16:54:02.458 [initandlisten] git version: nogitversion
Fri Sep 6 16:54:02.458 [initandlisten] build info: Darwin minimountain.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/ RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
Fri Sep 6 16:54:02.458 [initandlisten] allocator: tcmalloc
Fri Sep 6 16:54:02.458 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb", logappend: "true", logpath: "/usr/local/var/log/mongodb/mongo.log" }
Fri Sep 6 16:54:02.458 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Fri Sep 6 16:54:02.459 [initandlisten] recover : no journal files present, no recovery needed
Fri Sep 6 16:54:02.543 [websvr] admin web console waiting for connections on port 28017
Fri Sep 6 16:54:02.543 [initandlisten] waiting for connections on port 27017
Fri Sep 6 16:55:02.552 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 14ms
And this is a paste of my config file:
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Append logs to /usr/local/var/log/mongodb/mongo.log
logpath = /usr/local/var/log/mongodb/mongo.log
logappend = true
# Only accept local connections
bind_ip = 127.0.0.1
And a paste of command line:
-> mongod
all output going to: /usr/local/var/log/mongodb/mongo.log
mongo
Running a second shell and then running ./mongo in /usr/local/cellar/mongodb/2.4.6/ allowed me access to the shell.
Obvious solution, but documentation makes it seem like you can run it from the mongod prompt.

Unable to run solaris binary on solaris10

I am running solaris 10.
I downloaded the 2.4.1 driver from mongodb.org
Here are the logs:
foo $ ./mongod --dbpath /dpool/mongodb/data --pidfilepath /dpool/mongodb/run/mongod.pid
Wed Apr 10 21:19:54.832 [initandlisten] MongoDB starting : pid=25116 port=27017 dbpath=/dpool/mongodb/data 64-bit host=foo.example.net
Wed Apr 10 21:19:54.833 [initandlisten]
Wed Apr 10 21:19:54.833 [initandlisten] ** NOTE: your operating system version does not support the method that MongoDB
Wed Apr 10 21:19:54.833 [initandlisten] ** uses to detect impending page faults.
Wed Apr 10 21:19:54.833 [initandlisten] ** This may result in slower performance for certain use cases
Wed Apr 10 21:19:54.833 [initandlisten]
Wed Apr 10 21:19:54.833 [initandlisten] db version v2.4.1
Wed Apr 10 21:19:54.833 [initandlisten] git version: 1560959e9ce11a693be8b4d0d160d633eee75110
Wed Apr 10 21:19:54.833 [initandlisten] build info: SunOS bs-smartos-x86-64-1.10gen.cc 5.11 joyent_20120424T232010Z i86pc BOOST_LIB_VERSION=1_49
Wed Apr 10 21:19:54.833 [initandlisten] allocator: system
Wed Apr 10 21:19:54.833 [initandlisten] options: { dbpath: "/dpool/mongodb/data", pidfilepath: "/dpool/mongodb/run/mongod.pid" }
Segmentation Fault
foo $ echo $LD_LIBRARY_PATH
/usr/local/mongodb/lib
foo $ ls -lt /usr/local/mongodb/lib
total 6152
-rwxr-xr-x 1 mongo 255312 Oct 26 2009 libgcc_s.so.1
-rwxr-xr-x 1 mongo 5900688 Oct 26 2009 libstdc++.so.6
Any ideas? I used to run version 2.0.3 with no issues....
The MongoDB 2.4.1 build is currently done on SmartOS (which is based on OpenSolaris/Solaris 11), and there are some known issues on Solaris 10.
Your problem may be related to SERVER-7404 in the MongoDB Jira but there could be other issues.
One of the community suggestions on SERVER-7404 may be useful:
After downloading and installing libstdc++6-4.7.2\,REV\=2013.03.28-SunOS5.10-i386-CSW.pkg from opencsw it starts as usual
If you do get this working it would be helpful to comment on the Jira issue so other users know the fix.
This binary looks like to have been tuned for a SunOS 5.11 kernel. You might want to try it under either Solaris 11 or an Illumos based OS to avoid this warning message.

MongoDB provides a basic authentication system. Has it changed in version 2.2.3?

Scenario: Installed MongoDB 2.2.3 on the machine (Windows 64-bit)
Followed all the steps to enforce authentication on MongoDB server.
Added User to admin database
use admin
db.addUser('me_admin', '12345');
db.auth('me_admin','12345');
Ran database server (mongod.exe process) with the --auth option to enable
authentication
Followed all answers for similar question:
How to secure MongoDB with username and password
Issue: With new version 2.2.3 I am not able set up authentication. After following the same steps I was able to set up the authentication for the version 2.0.8 on the same machine. But its mentioned somewhere in MongoDB docs that "Authentication on Localhost varies slightly between before and after version 2.2"
Question: What is the change and how can enforce the authentication in new versions i.e. 2.2 onwards. Can anybody give some idea or solution to proceed the same with new MongoDB 2.2.3?
Update:
I had checked that authentication works same on 2.2.3 when I start mongod.exe process with --auth parameter from command prompt.
I was using auth=true parameter in config file as mentioned in docs, but this did not work.
Research done:
When mongod.cfg file contains following configurations
logpath=c:\mongodb\log\mongo.log, auth=true, profile=2
The log.txt file contains following logs
Mon Mar 11 15:06:35 Trying to start Windows service 'MongoDB'
Mon Mar 11 15:06:35 Service running
Mon Mar 11 15:06:35 [initandlisten] MongoDB starting : pid=7152 port=27017 dbpath=\data\db\ 64-bit host=AMOL-KULKARNI
Mon Mar 11 15:06:35 [initandlisten] db version v2.2.3, pdfile version 4.5
Mon Mar 11 15:06:35 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08
Mon Mar 11 15:06:35 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Mon Mar 11 15:06:35 [initandlisten] options: { config: "C:\mongodb\mongod.cfg", logpath: "c:\mongodb\log\mongo.log auth=true profile=2", service: true }
Mon Mar 11 15:06:35 [initandlisten] journal dir=/data/db/journal
Mon Mar 11 15:06:35 [initandlisten] recover : no journal files present, no recovery needed
Mon Mar 11 15:06:35 [initandlisten] waiting for connections on port 27017
Mon Mar 11 15:06:35 [websvr] admin web console waiting for connections on port 28017
When I run from command prompt mongod --auth, following log will be displayed:
Mon Mar 11 15:09:40 [initandlisten] MongoDB starting : pid=6536 port=27017 dbpath=\data\db\ 64-bit host=AMOL-KULKARNI
Mon Mar 11 15:09:40 [initandlisten] db version v2.2.3, pdfile version 4.5
Mon Mar 11 15:09:40 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08
Mon Mar 11 15:09:40 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Mon Mar 11 15:09:40 [initandlisten] options: { auth: true }
Mon Mar 11 15:09:40 [initandlisten] journal dir=/data/db/journal
Mon Mar 11 15:09:40 [initandlisten] recover : no journal files present, no recovery needed
Mon Mar 11 15:09:40 [initandlisten] waiting for connections on port 27017
Mon Mar 11 15:09:40 [websvr] admin web console waiting for connections on port 28017
Note: The change in the options:
options:{ config: "C:\mongodb\mongod.cfg", logpath:
"c:\mongodb\log\mongo.log auth=true profile=2", service: true } //Does not work
options: { auth: true } //Works
Interesting to observe is that,
When its ran from config file.
logpath=c:\mongodb\log\mongo.log, auth=true, profile=2
It got changed to:
logpath: "c:\mongodb\log\mongo.log auth=true profile=2", service: true
I know here is the issue. It should be like:
logpath: "c:\mongodb\log\mongo.log", auth=true, profile="2", service: true
So, the question is how to pass auth=true parameter from config file and run mongod.exe process as service on Windows7
The change is only minor as described under the part you quoted:
In general if there are no users for the admin database, you may connect via the localhost interface. For sharded clusters running version 2.2, if mongod is running with auth then all users connecting over the localhost interface must authenticate, even if there aren’t any users in the admin database.
Basically before 2.2 if you were in a sharded cluster you could connect to localhost and not be forced to auth if there are no users found in the admin database. This means that if you set-up a sharded cluster it might be wise to setup a default user, which you have already done.
Can anybody give some idea or solution to proceed the same with new MongoDB 2.2.3?
The new auth system will just be there, you don't need to do anything; it just will be.
Found out the solution.
To run MongoDB process (mongod.exe) as service with auth=true, following has to be taken care while registering MongoDB service itself (not mentioned in docs)
Service has to be registered with following command:
C:\mongodb\bin\mongod.exe --config C:\mongodb\mongod.cfg --auth --install
mongod.cfg file will have only logpath=c:\mongodb\log\mongo.log
Shared with you all so that effort & time will not be put on the same issue again.
Happy exploring to all.. :-)
Note this time log contains:
Mon Mar 11 15:58:06 Trying to start Windows service 'MongoDB'
Mon Mar 11 15:58:06 Service running
Mon Mar 11 15:58:06 [initandlisten] MongoDB starting : pid=6800 port=27017 dbpath=\data\db\ 64-bit host=AMOL-KULKARNI
Mon Mar 11 15:58:06 [initandlisten] db version v2.2.3, pdfile version 4.5
Mon Mar 11 15:58:06 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08
Mon Mar 11 15:58:06 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Mon Mar 11 15:58:06 [initandlisten] options: { auth: true, config: "C:\mongodb\mongod.cfg", logpath: "c:\mongodb\log\mongo.log", service: true }
Mon Mar 11 15:58:06 [initandlisten] journal dir=/data/db/journal
Mon Mar 11 15:58:06 [initandlisten] recover : no journal files present, no recovery needed
Mon Mar 11 15:58:06 [initandlisten] waiting for connections on port 27017
Mon Mar 11 15:58:06 [websvr] admin web console waiting for connections on port 28017

MongoDB Data disappeared

I just had to do an emergency reboot of my linux server. I did it gracefully, not a hard reboot. I have been gathering data through a node.js app for a month, but when the server started up again, all the data was gone!
I have a long log file: http://clintberry.com/mongod.log
I also ran a repair to see if it would help but to no avail.
New Development
It looks like I was running mongo with the command 'service mongod start' and when I try to run that command again, I get this:
**************
old lock file: /var/lib/mongo/mongod.lock. probably means unclean shutdown recommend
removing file and running --repair see: http://dochub.mongodb.org/core/repair
for more information
*************
So that means the repair I was trying was not working since I wasn't using the correct config file.
When I run repair with the correct config file it doesn't seem to run repair, just spits out this:
root#es2 [/var/log/mongo]# mongod --dbpath /var/lib/mongo/ --repair
Wed Nov 30 12:09:40 [initandlisten] MongoDB starting : pid=26916 port=27017 dbpath=/var/lib/mongo/ 64-bit
Wed Nov 30 12:09:40 [initandlisten] db version v1.8.4, pdfile version 4.5
Wed Nov 30 12:09:40 [initandlisten] git version: 81f12749a15e3d158b1b16bab6bc3faea538e166
Wed Nov 30 12:09:40 [initandlisten] build sys info: Linux bs-linux64.10gen.cc 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_41
**************
old lock file: /var/lib/mongo/mongod.lock. probably means unclean shutdown
recommend removing file and running --repair
see: http://dochub.mongodb.org/core/repair for more information
*************
Wed Nov 30 12:09:40 [initandlisten] exception in initAndListen std::exception: old lock file, terminating
Wed Nov 30 12:09:40 dbexit:
Wed Nov 30 12:09:40 [initandlisten] shutdown: going to close listening sockets...
Wed Nov 30 12:09:40 [initandlisten] shutdown: going to flush diaglog...
Wed Nov 30 12:09:40 [initandlisten] shutdown: going to close sockets...
Wed Nov 30 12:09:40 [initandlisten] shutdown: waiting for fs preallocator...
Wed Nov 30 12:09:40 [initandlisten] shutdown: closing all files...
Wed Nov 30 12:09:40 closeAllFiles() finished
Wed Nov 30 12:09:40 dbexit: really exiting now
As mpobrien's comment suggested, the issue was that when starting mongo it was using a different dbpath (location for the data). For those that have mongo installed on CentOS, if you use the service command to start mongo,
service mongod start
then mongo will use the configuration file /etc/mongo.conf when starting, which puts your dbpath as /var/lib/mongo
but if you start mongo with the regular mongod command, it will not use that folder and will use the mongo default.
Thanks for the help.