I have difficulty updating mongodb from version 2.0.6 to the current 2.4. Please help
Below is the log file that i get:
Tue May 14 08:02:03.339 [initandlisten] MongoDB starting : pid=1906 port=27017 dbpath=/mnt2/var/lib/mongodb/ 64-bit host=ip-10-131-65-73
Tue May 14 08:02:03.339 [initandlisten] db version v2.4.3
Tue May 14 08:02:03.339 [initandlisten] git version: fe1743177a5ea03e91e0052fb5e2cb2945f6d95f
Tue May 14 08:02:03.340 [initandlisten] build info: Linux ip-10-2-29-40 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
Tue May 14 08:02:03.340 [initandlisten] allocator: tcmalloc
Tue May 14 08:02:03.340 [initandlisten] options: { dbpath: "/mnt2/var/lib/mongodb/" }
Tue May 14 08:02:03.347 [initandlisten] journal dir=/mnt2/var/lib/mongodb/journal
Tue May 14 08:02:03.347 [initandlisten] recover : no journal files present, no recovery needed
Tue May 14 08:02:03.554 [initandlisten] build index backendtemp.system.users { user: 1, userSource: 1 }
Tue May 14 08:02:03.557 [initandlisten] Duplicate key exception while trying to build unique index on backendtemp.system.users. You most likely have user documents with duplicate "user" fields. To resolve this, start up with a version of MongoDB prior to 2.4, drop the duplicate user documents, then start up again with the current version.
Tue May 14 08:02:03.557 [initandlisten] exception in initAndListen: 11000 E11000 duplicate key error index: backendtemp.system.users.$user_1_userSource_1 dup key: { : "ad", : null }, terminating
Tue May 14 08:02:03.557 dbexit:
Tue May 14 08:02:03.557 [initandlisten] shutdown: going to close listening sockets...
Tue May 14 08:02:03.557 [initandlisten] shutdown: going to flush diaglog...
Tue May 14 08:02:03.557 [initandlisten] shutdown: going to close sockets...
Tue May 14 08:02:03.558 [initandlisten] shutdown: waiting for fs preallocator...
Tue May 14 08:02:03.558 [initandlisten] shutdown: lock for final commit...
Tue May 14 08:02:03.558 [initandlisten] shutdown: final commit...
Tue May 14 08:02:03.572 [initandlisten] shutdown: closing all files...
Tue May 14 08:02:03.573 [initandlisten] closeAllFiles() finished
Tue May 14 08:02:03.573 [initandlisten] journalCleanup...
Tue May 14 08:02:03.573 [initandlisten] removeJournalFiles
Tue May 14 08:02:03.575 [initandlisten] shutdown: removing fs lock...
Tue May 14 08:02:03.575 dbexit: really exiting now
In version 2.4 MongoDB introduced a role-based access control which requires uniqueness of the user in user privilege documents per database. Previous versions of MongoDB didn't have this requirement, so that your database may have duplicate user entries in system.users.
You can either:
Downgrade MongoDB to an older version, remove the duplicate
entries and upgrade MongoDB again, or:
If you are in a
development environment and/or don't care about your data (i.e.
loosing your entire database), you can remove
the database files manually through your filesystem. On Linux they
are usually located at "/var/lib/mongodb/name-of-the-database".
Try starting MongoDB after that and you are cool.
See: MongoDB 2.4 Upgrade Recommendations and Checklist
Small script pasties regarding this (ubuntu):
NOTE: replace CAPS by you vars...
If its a sharded cluster, always make sure balancer is off before this kinda things.
Run sudo apt-get install mongodb-10gen=2.2.7 <- reduce version, probably want 2.2.7 its the latest pre-2.4 (as of May 2014)
Remember to restart mongod config server
connect using mongoCONFIG_SERVER_HOST:CONFIG_SERVER_PORT/admin # <- connect to mongo config server,
db.system.users.find().sort({_id:1}) <- would display the admin users sorted by id which is like sorting ascending by time here, coz its bson.
db.system.users.remove({_id : ObjectId('ID_TO_BE_REMOVED')}) <- remove the culprit, USE WITH CARE. if you not sure, start by creating another admin user for backup.
Quit the mongo console
Run sudo apt-get install mongodb-10gen <- will upgrade back to latest 2.4.X. not it will not upgrade to 2.6 (which is good, coz you want to ensure 2.4 is working first) because its a different apt-get package for 2.6 (mongodb-org).
HTH
If you can't or won't downgrade mongodb, you can also use mongodump and then mongorestore. You will loose every mongo user but get your data back.
mongodump --dbpath OLD_DB_PATH -d DATABASENAME -o /tmp/dumps
mongorestore --dbpath NEW_DB_PATH -d DATABASENAME /tmp/dumps/DATABASENAME/
As always with mongo, be careful about the permissions of the restored files if you do not run the above commands as the mongodb user.
This won't work if your current mongodb version is at least 3.0 because the dbpath option has been removed, forcing you to have a running mongod on the dbpath to run those commands, which is precisely what's not working right now...
In case you have problems, you may try to run mongod --dbpath NEW_DB_PATH --repair
Related
Yesterday I have upgraded my Ubuntu 14.10 to 15.04. But which lead me to stop my work. I was working on chicagoboss and mongodb. i saw error that mongodb has crashed.
By typing just mongo got following error:
$ mongo
MongoDB shell version: 2.4.10
connecting to: test
Mon May 11 11:26:32.985 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
Followed stackoverflow query and removed .lock file. Then tried to repair using
$sudo mongod --repair
Then got an error:
*********************************************************************
ERROR: dbpath (/data/db/) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
I observed that in my mongodb.conf file dbpath is /var/lib/mongodb. Which is correct where I found all my mongodb databases.So I tried to set dbpath to the same location but getting error:
$ mongod --dbpath "/var/lib/mongodb"
Mon May 11 11:33:18.607 [initandlisten] MongoDB starting : pid=4450 port=27017 dbpath=/var/lib/mongodb 64-bit host=laxmikant-alphonso
Mon May 11 11:33:18.607 [initandlisten] db version v2.4.10
Mon May 11 11:33:18.607 [initandlisten] git version: e3d78955d181e475345ebd60053a4738a4c5268a
Mon May 11 11:33:18.607 [initandlisten] build info: Linux ip-10-2-29-40 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
Mon May 11 11:33:18.607 [initandlisten] allocator: tcmalloc
Mon May 11 11:33:18.607 [initandlisten] options: { dbpath: "/var/lib/mongodb" }
Mon May 11 11:33:18.607 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /var/lib/mongodb/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Mon May 11 11:33:18.607 dbexit:
Mon May 11 11:33:18.607 [initandlisten] shutdown: going to close listening sockets...
Mon May 11 11:33:18.607 [initandlisten] shutdown: going to flush diaglog...
Mon May 11 11:33:18.607 [initandlisten] shutdown: going to close sockets...
Mon May 11 11:33:18.607 [initandlisten] shutdown: waiting for fs preallocator...
Mon May 11 11:33:18.607 [initandlisten] shutdown: lock for final commit...
Mon May 11 11:33:18.607 [initandlisten] shutdown: final commit...
Mon May 11 11:33:18.607 [initandlisten] shutdown: closing all files...
Mon May 11 11:33:18.608 [initandlisten] closeAllFiles() finished
Mon May 11 11:33:18.608 [initandlisten] shutdown: removing fs lock...
Mon May 11 11:33:18.608 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Mon May 11 11:33:18.608 dbexit: really exiting now
How can I resolve this issue. I want all my databases back.
Also I checked that I'm getting following error for service start:
$ sudo service mongodb start
Failed to start mongodb.service: Unit mongodb.service failed to load: No such file or directory.
$ mongod --dbpath "/var/lib/mongodb"
In that case, you start mongodb as yourself. And you probably don't have R/W permission on the data directory.
$ sudo service mongodb start
Now you start mongodb as a service and it will probably change its identity from root to "mongo" or something like that. On debian-like system, the configuration for mongodb is in /etc/init/mongodb.conf or preferably in /etc/mongodb.conf. See http://packages.ubuntu.com/utopic/amd64/mongodb-server/filelist. There you can change the database path.
BTW, check the permissions for your data directory. The user "mongo"-or-whatever should have write access there:
$ ls -l /var/lib/mongodb
The process of adding a mongoDb (2.4) cartridge to my OpenShift application seems to work fine but ends up with an error and no cartridge is added. It looks like a disk space problem (I have already mysql in the same application), but I freed plenty of space and, strangely enough, the problem only appears at the very end of setup. Here is the log (hiding login details):
Starting MongoDB cartridge
note: noprealloc may hurt performance in many applications
Sat May 3 19:38:54.847 [initandlisten] MongoDB starting : pid=389973 port=2701
dbpath=/var/lib/openshift/5c0013917b4d45c68fddbb75e082a35a/mongodb/data/ 64-bit host=ex-std-node94.prod.rhcloud.com
Sat May 3 19:38:54.848 [initandlisten] db version v2.4.6
Sat May 3 19:38:54.848 [initandlisten] git version: nogitversion
Sat May 3 19:38:54.848 [initandlisten] build info: Linux x86-023.build.eng.bos.redhat.com 2.6.18-371.el5 #1 SMP Thu Sep 5 21:21:44 EDT 2013 x86_64 BOOST_LIB_VERSION=1_41
Sat May 3 19:38:54.849 [initandlisten] allocator: tcmalloc
Sat May 3 19:38:54.849 [initandlisten] options: { auth: true, bind_ip: "127.2.148.131", config: "/tmp/mongodb.repair.conf", dbpath: "/var/lib/openshift/5c0013917b4d45c68fddbb75e082a35a/mongodb/data/", nohttpinterface: "true", noprealloc: "true", pidfilepath: "/var/lib/openshift/5c0013917b4d45c68fddbb75e082a35a/mongodb/pid/mongodb.pid", quiet: "true", repair: true, smallfiles: "true" }
**************
You specified --repair but there are dirty journal files. Please
restart without --repair to allow the journal files to be replayed.
If you wish to repair all databases, please shutdown cleanly and
run with --repair again.
**************
Sat May 3 19:38:54.865 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
Sat May 3 19:38:54.866 dbexit:
Sat May 3 19:38:54.866 [initandlisten] shutdown: going to close listening sockets...
Sat May 3 19:38:54.866 [initandlisten] shutdown: going to flush diaglog...
Sat May 3 19:38:54.867 [initandlisten] shutdown: going to close sockets...
Sat May 3 19:38:54.867 [initandlisten] shutdown: waiting for fs preallocator...
Sat May 3 19:38:54.867 [initandlisten] shutdown: closing all files...
Sat May 3 19:38:54.867 [initandlisten] closeAllFiles() finished
Sat May 3 19:38:54.868 dbexit: really exiting now
Warning: Gear 5c0013917b4d45c68fddbb75e082a35a is using 98.9% of disk quota
Warning: Gear 5c0013917b4d45c68fddbb75e082a35a is using 97.3% of disk quota
Attempting to repair MongoDB ...
MongoDB 2.4 database added. Please make note of these credentials:
Root User: ------------
Root Password: ------------
Database Name: ------------
Connection URL: mongodb://$OPENSHIFT_MONGODB_DB_HOST:$OPENSHIFT_MONGODB_DB_PORT/
Failed to execute: 'control start' for /var/lib/openshift/5c0013917b4d45c68fddbb75e082a35a/mongodb
Any idea on how to solve it? Thank you
Yes, as per the logs it looks like you have consumed most of your 1GB disk space. The 1 GB disk space is consumed by all your application cartridges and storage.Which web cartridge are you using? Can you check the disk space usage using quota -s command. SSH into the application gear and run quota -s command. Or if you have rhc command-line installed then you can use rhc ssh --app <app_name> --command 'quota -s'. You can clean up disk space using rhc tidy --app <app_name> command. After cleaning up, try running rhc cartridge command again. You can create a scalable application and that would allow every cartridge to be installed on a different gear. This would allow each cartridge more disk space.
I installed MondoDB on my Ubuntu 13.04 and tried to run its daemon by typing in either mongod or sudo mongod, but I encountered the following message:
mongod --help for help and startup options
Thu Jun 27 05:11:02 [initandlisten] MongoDB starting : pid=11685 port=27017 dbpath=/data/db/ 64-bit host=myhost
Thu Jun 27 05:11:02 [initandlisten] db version v2.2.4, pdfile version 4.5
Thu Jun 27 05:11:02 [initandlisten] git version: nogitversion
Thu Jun 27 05:11:02 [initandlisten] build info: Linux batsu 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 BOOST_LIB_VERSION=1_49
Thu Jun 27 05:11:02 [initandlisten] options: {}
Thu Jun 27 05:11:02 [initandlisten] journal dir=/data/db/journal
Thu Jun 27 05:11:02 [initandlisten] recover : no journal files present, no recovery needed
Thu Jun 27 05:11:02 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Thu Jun 27 05:11:02 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
Thu Jun 27 05:11:02 [websvr] ERROR: addr already in use
Thu Jun 27 05:11:02 [initandlisten] ERROR: addr already in use
Thu Jun 27 05:11:02 [initandlisten] now exiting
Thu Jun 27 05:11:02 dbexit:
Thu Jun 27 05:11:02 [initandlisten] shutdown: going to close listening sockets...
Thu Jun 27 05:11:02 [initandlisten] shutdown: going to flush diaglog...
Thu Jun 27 05:11:02 [initandlisten] shutdown: going to close sockets...
Thu Jun 27 05:11:02 [initandlisten] shutdown: waiting for fs preallocator...
Thu Jun 27 05:11:02 [initandlisten] shutdown: lock for final commit...
Thu Jun 27 05:11:02 [initandlisten] shutdown: final commit...
Thu Jun 27 05:11:02 [initandlisten] shutdown: closing all files...
Thu Jun 27 05:11:02 [initandlisten] closeAllFiles() finished
Thu Jun 27 05:11:02 [initandlisten] journalCleanup...
Thu Jun 27 05:11:02 [initandlisten] removeJournalFiles
Thu Jun 27 05:11:02 [initandlisten] shutdown: removing fs lock...
Thu Jun 27 05:11:02 dbexit: really exiting now
However, when I tried to run MongoDB by typing mongo even without running its daemon, it seems that I can use MongoDB successfully. I don't start any daemon and also I have only one window in my terminal, so it would be impossible to run both daemon and main mongo program at the same time...
So the question is, why I can use MongoDB without starting any daemon process? When I use MongoDB on OS X, I always have to run daemon before using MongoDB. For your information I installed Ubuntu 13.04 via Parallels 8 on my OS X 10.8 and installed MongoDB by going with the same route as an official document explains.
Or since I use MongoDB on my OS X at port 27017, I don't have to run daemon on Virtual Ubuntu? (though I don't run daemon on OS X right now...)
When you installed mongo, it should already have run the server for you.
This is confirmed by both the fact that it says "addr already in use" (which means something is running on the mongod port) and the fact that you can use it successfully.
You can also test this by running ps wuax | grep mongo and looking for mongod in the resulting list - this list all the processes running on your computer, and then removes from this list anything that doesn't mention mongo. You may also see a line which has "grep" in it - this is the command you are currently running, which you can ignore.
When I run this on my computer, it shows:
mongodb 22394 9.1 1.0 109244 33592 ? Dsl 08:29 0:01 /usr/bin/mongod --config /etc/mongodb.conf
1001 22423 0.0 0.0 9436 904 pts/3 S+ 08:29 0:00 grep --color=auto mongo
Mongod service is running, try to stop it and init mongod with sudo command
sudo service mongodb stop
sudo mongod
Start mongod Processes
By default, MongoDB stores data in the /data/db directory. On Windows, MongoDB stores data in C:\data\db. On all platforms, MongoDB listens for connections from clients on port 27017.
To start MongoDB using all defaults, issue the following command at the system shell:
mongod
Stop mongod Processes
In a clean shutdown a mongod completes all pending operations, flushes all data to data files, and closes all data files. Other shutdowns are unclean and can compromise the validity of the data files.
To ensure a clean shutdown, always shutdown mongod instances using one of the following methods:
Use shutdownServer()
Shut down the mongod from the mongo shell using the db.shutdownServer() method as follows:
use admin
db.shutdownServer()
Calling the same method from a init script accomplishes the same result.
For systems with authorization enabled, users may only issue db.shutdownServer() when authenticated to the admin database or via the localhost interface on systems without authentication enabled.
Use --shutdown
From the Linux command line, shut down the mongod using the --shutdown option in the following command:
mongod --shutdown
I'm new to MongoDB, and I'm trying to run mongod. If I type in mongo, I can run the shell (and then I exit nicely with ^C), but when I try typing mongod, I get this:
mongod --help for help and startup options
Sat Nov 24 13:42:34 [initandlisten] MongoDB starting : pid=99910 port=27017 dbpath=/data/db/ 64-bit host=Macbook-err.local
Sat Nov 24 13:42:34 [initandlisten]
Sat Nov 24 13:42:34 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Sat Nov 24 13:42:34 [initandlisten] db version v2.2.1, pdfile version 4.5
Sat Nov 24 13:42:34 [initandlisten] git version: nogitversion
Sat Nov 24 13:42:34 [initandlisten] build info: Darwin 172-26-13-128.dynapool.nyu.edu 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
Sat Nov 24 13:42:34 [initandlisten] options: {}
Sat Nov 24 13:42:34 [initandlisten] journal dir=/data/db/journal
Sat Nov 24 13:42:34 [initandlisten] recover : no journal files present, no recovery needed
Sat Nov 24 13:42:34 [websvr] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:28017
Sat Nov 24 13:42:34 [websvr] ERROR: addr already in use
Sat Nov 24 13:42:34 [initandlisten] ERROR: listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
Sat Nov 24 13:42:34 [initandlisten] ERROR: addr already in use
Sat Nov 24 13:42:34 [initandlisten] now exiting
Sat Nov 24 13:42:34 dbexit:
Sat Nov 24 13:42:34 [initandlisten] shutdown: going to close listening sockets...
Sat Nov 24 13:42:34 [initandlisten] shutdown: going to flush diaglog...
Sat Nov 24 13:42:34 [initandlisten] shutdown: going to close sockets...
Sat Nov 24 13:42:34 [initandlisten] shutdown: waiting for fs preallocator...
Sat Nov 24 13:42:34 [initandlisten] shutdown: lock for final commit...
Sat Nov 24 13:42:34 [initandlisten] shutdown: final commit...
Sat Nov 24 13:42:34 [initandlisten] shutdown: closing all files...
Sat Nov 24 13:42:34 [initandlisten] closeAllFiles() finished
Sat Nov 24 13:42:34 [initandlisten] journalCleanup...
Sat Nov 24 13:42:34 [initandlisten] removeJournalFiles
Sat Nov 24 13:42:34 [initandlisten] shutdown: removing fs lock...
Sat Nov 24 13:42:34 dbexit: really exiting now
This seems to be a common problem around here, and I've tried:
deleting the mongod.lock file rm /data/db/mongod.lock
repair: mongod --repair
killing processes: killall -15 mongod and killall -9 mongod
I tried changing permissions: sudo chmod 0755 /data/db and sudo chown $USER /data/db
My permissions seem correct:
drwxr-xr-x 4 slaffont wheel 136 Nov 24 13:28 /data/db/
I've run out of ideas. Has anyone else had this problem? What should I do? :(
From your main comments, it seems you installed MongoDB via macports (given the /opt install location). What I believe might be happening is that the recipe for macports installed MongoDB as a launchd service.
Check this location for a mongodb related plist file: /Library/LaunchDaemons
If you find it, that means your system will automatically keep this service running. If you only want to run the mongod manually, then remove this plist and reboot. Or you can try this command:
launchctl unload /Library/LaunchDaemons/path.to.mongo.plist
Otherwise, run another instance of mongod on a different port.
sudo rm /var/lib/mongodb/mongod.lock
sudo chown -R mongodb:mongodb /var/lib/mongodb/
sudo -u mongodb mongod -f /etc/mongodb.conf --repair
sudo service mongodb start
or instead of the last one try : sudo mongod
"Address already in use for socket: 0.0.0.0:28017"
It looks like mongo is already running or another process is using port 27017
In this case, type the following command
ps wuax | grep mongo
You should see something that looks like this
User 31936 0.5 0.4 2719784 35624 ?? S 7:34pm 0:09.98 mongod
User 31945 0.0 0.0 2423368 184 s000 R+ 8:24pm 0:00.00 grep mongo
Now enter the kill command for the mongod instance (31936 in this case):
kill 31936
It looks like something is already bound to port 27017, making it seem like another mongod is running (that was not killed on the killall). Does the output of ps aux or lsof -i :27017 show any mongod processes running?
If this proves completely fruitless, you can always pass the --port <portnum> option to the mongod process via the command line, telling it to listen on a different port (use the same option for the mongo shell to tell it to connect on a different port than 27017.
As #shelman said, you already have something using that port, however your command to understand if something is running is wrong, try:
sudo netstat -lpn |grep :27017
I have noticed as well:
Sat Nov 24 13:42:34 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
This is more of an warning but still one you should heed. I answered a question with some one who had this problem recently: Mongod runs, but Mongo returns an error that should help.
Since this seems to be a common question:
As someone who just had/solved this problem, what you're probably running into is this. When you first install Mongo (say, via apt-get), the Mongod process automatically starts running. For example:
terekhov / $ sudo apt-get install mongodb-10gen
--Snip Install Process--
Done. mongodb
start/running, process 4467 Processing triggers for ureadahead ...
terekhov / $ service mongodb start start: Job is already running: mongodb
So, if you don't need a forked daemon etc, then just type mongo to start the command shell; it will automatically search for a MongoDB daemon on port 27017. Happily, that's where ours is.
You can start/stop/restart the mongod process with this command: sudo service mongodb stop
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.