Mongo not starting on Ubuntu - mongodb

I installed mongo on ubuntu using the instructions on the following page:
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
deploy#stockgame-with-login:~$ mongod --dbpath ~/data/db
Sun Jan 10 15:16:22.090 [initandlisten] MongoDB starting : pid=28452 port=27017 dbpath=/home/deploy/data/db 64-bit host=stockgame-with-login
Sun Jan 10 15:16:22.091 [initandlisten] db version v2.4.14
Sun Jan 10 15:16:22.092 [initandlisten] git version: 05bebf9ab15511a71bfbded684bb226014c0a553
Sun Jan 10 15:16:22.092 [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
Sun Jan 10 15:16:22.092 [initandlisten] allocator: tcmalloc
Sun Jan 10 15:16:22.093 [initandlisten] options: { dbpath: "/home/deploy/data/db" }
Sun Jan 10 15:16:22.098 [initandlisten] journal dir=/home/deploy/data/db/journal
Sun Jan 10 15:16:22.099 [initandlisten] recover : no journal files present, no recovery needed
Sun Jan 10 15:16:22.209 [initandlisten] ****
Sun Jan 10 15:16:22.210 [initandlisten] ****
Sun Jan 10 15:16:22.210 [initandlisten] need to upgrade database local with pdfile version 4.22, new version: 4.5
Sun Jan 10 15:16:22.210 [initandlisten] Not upgrading, exiting
Sun Jan 10 15:16:22.210 [initandlisten] run --upgrade to upgrade dbs, then start again
Sun Jan 10 15:16:22.210 [initandlisten] ****
Sun Jan 10 15:16:22.210 dbexit:
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: going to close listening sockets...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: going to flush diaglog...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: going to close sockets...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: waiting for fs preallocator...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: lock for final commit...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: final commit...
Sun Jan 10 15:16:22.211 [initandlisten] shutdown: closing all files...
Sun Jan 10 15:16:22.213 [initandlisten] closeAllFiles() finished
Sun Jan 10 15:16:22.213 [initandlisten] journalCleanup...
Sun Jan 10 15:16:22.213 [initandlisten] removeJournalFiles
Sun Jan 10 15:16:22.214 [initandlisten] shutdown: removing fs lock...
Sun Jan 10 15:16:22.215 dbexit: really exiting now
deploy#stockgame-with-login:~$

You need to run
mongod --dbpath ~/data/db --upgrade
The current database you are pointing appears to be from an older version of Mongo and it's format is deprecated.
Beware that this --upgrade argument will most likely not be backwards compatible, and older Mongo versions will not be able to read it. If that's not acceptable, you will need to open the database with an older version of Mongo such as 2.6.

Related

Unable to start MongoDB. ERROR: addr already in use

I tried running MongoDB in local server with mongod command and it failed to run. The error:
mongod --help for help and startup options
Sat Jan 31 13:07:16.392 [initandlisten] MongoDB starting : pid=5127 port=27017 dbpath=/data/db/ 64-bit host=leandrotk
Sat Jan 31 13:07:16.392 [initandlisten] db version v2.4.9
Sat Jan 31 13:07:16.392 [initandlisten] git version: nogitversion
Sat Jan 31 13:07:16.392 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Sat Jan 31 13:07:16.392 [initandlisten] allocator: tcmalloc
Sat Jan 31 13:07:16.392 [initandlisten] options: {}
Sat Jan 31 13:07:16.435 [initandlisten] journal dir=/data/db/journal
Sat Jan 31 13:07:16.435 [initandlisten] recover : no journal files present, no recovery needed
Sat Jan 31 13:07:16.513 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Sat Jan 31 13:07:16.514 [initandlisten] ERROR: addr already in use
Sat Jan 31 13:07:16.514 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
Sat Jan 31 13:07:16.514 [initandlisten] now exiting
Sat Jan 31 13:07:16.514 [websvr] ERROR: addr already in use
Sat Jan 31 13:07:16.514 dbexit:
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: going to close listening sockets...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: going to flush diaglog...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: going to close sockets...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: waiting for fs preallocator...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: lock for final commit...
Sat Jan 31 13:07:16.514 [initandlisten] shutdown: final commit...
Sat Jan 31 13:07:16.599 [initandlisten] shutdown: closing all files...
Sat Jan 31 13:07:16.599 [initandlisten] closeAllFiles() finished
Sat Jan 31 13:07:16.599 [initandlisten] journalCleanup...
Sat Jan 31 13:07:16.599 [initandlisten] removeJournalFiles
Sat Jan 31 13:07:16.668 [initandlisten] shutdown: removing fs lock...
Sat Jan 31 13:07:16.668 dbexit: really exiting now
you already have a process running
killall mongod
should kill the other process, if you have another kind of process bound to that port you could find it with netstat | grep 27017
Try this:
sudo service mongodb stop
sudo mongod
some version is:
sudo service mongod stop
mongod: mongo damon

Error in textSearchEnable=true in MongoDB

I am getting the below error when enabling text search in mongodb. Any Suggestion.
I have mongo.config filw which contains :
##store data here
dbpath=C:\mongodb\data
##all output go here
logpath=C:\mongodb\log\mongo.log
##log read and write operations
diaglog=3
Error is :
C:\mongodb-win32-x86_64-2.4.6\bin>mongod --setParameter textSearchEnabled=true
Tue Jan 14 16:52:51.336 [initandlisten] MongoDB starting : pid=976 port=27017 dbpath=\data\db\ 64-bit host=dellvostro3
Tue Jan 14 16:52:51.337 [initandlisten] db version v2.4.6
Tue Jan 14 16:52:51.337 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Tue Jan 14 16:52:51.337 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack
1') BOOST_LIB_VERSION=1_49
Tue Jan 14 16:52:51.337 [initandlisten] allocator: system
Tue Jan 14 16:52:51.337 [initandlisten] options: { setParameter: [ "textSearchEnabled=true" ] }
Tue Jan 14 16:52:51.337 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (\data\db\) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
Tue Jan 14 16:52:51.338 dbexit:
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: going to close listening sockets...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: going to flush diaglog...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: going to close sockets...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: waiting for fs preallocator...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: lock for final commit...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: final commit...
Tue Jan 14 16:52:51.338 [initandlisten] shutdown: closing all files...
Tue Jan 14 16:52:51.338 [initandlisten] closeAllFiles() finished
Tue Jan 14 16:52:51.338 dbexit: really exiting now
You provide wrong path to your data
ERROR: dbpath (\data\db\) does not exist.
\data\db\ is default mongo data path, you need to create this directory or get provide another path when running mongod
When you run
mongod --setParameter textSearchEnabled=true
MongoDB will take \data\db\ as the dbpath. Which is not there in your machine and hence you get the error.
I see you have a config file containing the dbpath etc, but you haven't specified the config file while starting mongod.
mongod --config mongo.config --setParameter textSearchEnabled=true
See using config file here.
Also you could move the textSearchEnabled=true to your config file.
##store data here
dbpath=C:\mongodb\data
##all output go here
logpath=C:\mongodb\log\mongo.log
##log read and write operations
diaglog=3
setParameter=textSearchEnabled=true
Now you can start mongod by just using
mongod --config mongo.config

Mongo service doesn't connect

I just did a manual installation of mongoDB like the documentation says and when I run ./mongocommand this is what I get.
./mongo
MongoDB shell version: 2.4.8
connecting to: test
It doesn't say anymore and doesn't connect to testdatabase.
Anyone know how can I solve this problem?
Thank's in advance
EDIT: I uninstall all and re-install using Brew. Now this is what I get when I run mongod
all output going to: /usr/local/var/log/mongodb/mongo.log
And this when i run mongo
MongoDB shell version: 2.4.8
connecting to: test
Wed Jan 8 13:35:04.634 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed
And this is what /usr/local/var/log/mongodb/mongo.logshows
***** SERVER RESTARTED *****
Wed Jan 8 13:34:11.749 [initandlisten] MongoDB starting : pid=745 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=MacBook-Pro-de-Kemical.local
Wed Jan 8 13:34:11.749 [initandlisten]
Wed Jan 8 13:34:11.749 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Wed Jan 8 13:34:11.749 [initandlisten] db version v2.4.8
Wed Jan 8 13:34:11.749 [initandlisten] git version: nogitversion
Wed Jan 8 13:34:11.749 [initandlisten] build info: Darwin minimountain.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
Wed Jan 8 13:34:11.749 [initandlisten] allocator: tcmalloc
Wed Jan 8 13:34:11.749 [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" }
Wed Jan 8 13:34:11.750 [initandlisten] exception in initAndListen: 10310 Unable to lock file: /usr/local/var/mongodb/mongod.lock. Is a mongod instance already running?, terminating
Wed Jan 8 13:34:11.750 dbexit:
Wed Jan 8 13:34:11.750 [initandlisten] shutdown: going to close listening sockets...
Wed Jan 8 13:34:11.750 [initandlisten] shutdown: going to flush diaglog...
Wed Jan 8 13:34:11.750 [initandlisten] shutdown: going to close sockets...
Wed Jan 8 13:34:11.750 [initandlisten] shutdown: waiting for fs preallocator...
Wed Jan 8 13:34:11.750 [initandlisten] shutdown: lock for final commit...
Wed Jan 8 13:34:11.750 [initandlisten] shutdown: final commit...
Wed Jan 8 13:34:11.750 [initandlisten] shutdown: closing all files...
Wed Jan 8 13:34:11.750 [initandlisten] closeAllFiles() finished
Wed Jan 8 13:34:11.750 dbexit: really exiting now
First of all, have you actually started the "mongod" server process?
If you have, you need to find out what is happening and one way to do this is with the "strace" tool. Running it like follows creates a log file in /tmp/strace.log and that should tell you system level wise what's going on:
strace -o /tmp/strace.log ./mongo

meteor is not starting

I am having problems with launching Meteor examples.
That is what i get when I type meteor in application folder
[[[[[ ~/parties ]]]]]
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod
MongoDB had an unspecified uncaught exception.
Check to make sure that MongoDB is able to write to its database directory.
I have already tried meteor reset and removing .meteor/local/db/mongo.lock - nothing changes
I tried typing mongod
mongod --help for help and startup options
Sun Jun 2 00:00:39.080 [initandlisten] MongoDB starting : pid=1962 port=27017 dbpath=/data/db/ 64-bit host=orion
Sun Jun 2 00:00:39.081 [initandlisten] db version v2.4.3
Sun Jun 2 00:00:39.081 [initandlisten] git version: fe1743177a5ea03e91e0052fb5e2cb2945f6d95f
Sun Jun 2 00:00:39.081 [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
Sun Jun 2 00:00:39.081 [initandlisten] allocator: tcmalloc
Sun Jun 2 00:00:39.081 [initandlisten] options: {}
Sun Jun 2 00:00:39.083 [initandlisten] exception in initAndListen std::exception: locale::facet::_S_create_c_locale name not valid, terminating
Sun Jun 2 00:00:39.083 dbexit:
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: going to close listening sockets...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: going to flush diaglog...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: going to close sockets...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: waiting for fs preallocator...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: lock for final commit...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: final commit...
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: closing all files...
Sun Jun 2 00:00:39.083 [initandlisten] closeAllFiles() finished
Sun Jun 2 00:00:39.083 [initandlisten] shutdown: removing fs lock...
Sun Jun 2 00:00:39.084 dbexit: really exiting now
However, when I use sudo service mongodb stop or start everything works fine and I can query database
MongoDB shell version: 2.4.3
connecting to: test
> db.test.save( { a: 1 } )
> db.test.find()
{ "_id" : ObjectId("51aa70cc07bf3387b90934ce"), "a" : 1 }
I am using Ubuntu 12.04 (VPS) if it matters
According to your logs the reason of mongod couldn't start is in wrong LC_ALL locale value. Try to execute "export LC_ALL=C" before you start mongod. Related issue in bugtracker

MongoDB Catch-22 won't let me drop huge collection

So I have a 2TB hard drive with 2 collections in 1 mongoDB.
Collection 1 is about 500gb and completely essential
Collection 2 is about 1500gb and needs to be deleted.
I was running a process that accidentally filled up the entire HDD, leaving 0% space. There is literally nothing on the machine apart from a Linux Distro and this mongoDB.
I would like to delete Collection 2.
In order to do this, I would normally just go into mongo and type db.collection.drop()
However, mongoDB is not currently running. In order to start it, I'm using:
[bobby#myPC bin]# ./mongod --dbpath /home/mongo &
However, since there is no space on the HDD, it returns:
[bobby#myPC bin]# Thu Feb 14 17:47:10 [initandlisten] MongoDB starting : pid=1264 port=27017 dbpath=/home/mongo 64-bit host=localhost.localdomain
Thu Feb 14 17:47:10 [initandlisten] db version v2.2.3, pdfile version 4.5
Thu Feb 14 17:47:10 [initandlisten] git version: f570771a5d8a3846eb7586eaffcf4c2f4a96bf08
Thu Feb 14 17:47:10 [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
Thu Feb 14 17:47:10 [initandlisten] options: { dbpath: "/home/mongo" }
Thu Feb 14 17:47:10 [initandlisten] journal dir=/home/mongo/journal
Thu Feb 14 17:47:10 [initandlisten] recover : no journal files present, no recovery needed
Thu Feb 14 17:47:10 [initandlisten]
Thu Feb 14 17:47:10 [initandlisten] ERROR: Insufficient free space for journal files
Thu Feb 14 17:47:10 [initandlisten] Please make at least 3379MB available in /home/mongo/journal or use --smallfiles
Thu Feb 14 17:47:10 [initandlisten]
Thu Feb 14 17:47:10 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
Thu Feb 14 17:47:10 dbexit:
Thu Feb 14 17:47:10 [initandlisten] shutdown: going to close listening sockets...
Thu Feb 14 17:47:10 [initandlisten] shutdown: going to flush diaglog...
Thu Feb 14 17:47:10 [initandlisten] shutdown: going to close sockets...
Thu Feb 14 17:47:10 [initandlisten] shutdown: waiting for fs preallocator...
Thu Feb 14 17:47:10 [initandlisten] shutdown: lock for final commit...
Thu Feb 14 17:47:10 [initandlisten] shutdown: final commit...
Thu Feb 14 17:47:10 [initandlisten] shutdown: closing all files...
Thu Feb 14 17:47:10 [initandlisten] closeAllFiles() finished
Thu Feb 14 17:47:10 [initandlisten] journalCleanup...
Thu Feb 14 17:47:10 [initandlisten] removeJournalFiles
Thu Feb 14 17:47:10 [initandlisten] shutdown: removing fs lock...
Thu Feb 14 17:47:10 dbexit: really exiting now
I can't remove this collection cause there's no space. And there's no space because I can't remove this collection.
How can I fix this? Is there some way of identifying which mongoDB files in /home/mongo I can take out?
Based on the error message, its complaining about not having enough space for the journal. Its not ideal in a production environment to run with out journaling, but you could try starting with out it while you fix the issue.
./mongod --nojournal --dbpath /home/mongo &
edit: to answer your question though, mongo creates and allocates files per database, not collection. So you wouldn't be able to target a specific file to remove a collection.