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
Related
when I run sudo mongod on my ubuntu 14.04 it gives below error
mongod --help for help and startup options
Tue Mar 7 09:42:15.992 [initandlisten] MongoDB starting : pid=2870 port=27017 dbpath=/data/db/ 64-bit host=keshav-mohta
Tue Mar 7 09:42:15.992 [initandlisten] db version v2.4.9
Tue Mar 7 09:42:15.992 [initandlisten] git version: nogitversion
Tue Mar 7 09:42:15.992 [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
Tue Mar 7 09:42:15.992 [initandlisten] allocator: tcmalloc
Tue Mar 7 09:42:15.992 [initandlisten] options: {}
Tue Mar 7 09:42:16.431 [initandlisten] journal dir=/data/db/journal
Tue Mar 7 09:42:16.435 [initandlisten] recover : no journal files present, no recovery needed
Tue Mar 7 09:42:17.587 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
Tue Mar 7 09:42:17.587 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Tue Mar 7 09:42:17.587 [websvr] ERROR: addr already in use
Tue Mar 7 09:42:17.587 [initandlisten] ERROR: addr already in use
Tue Mar 7 09:42:17.587 [initandlisten] now exiting
Tue Mar 7 09:42:17.587 dbexit:
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: going to close listening sockets...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: going to flush diaglog...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: going to close sockets...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: waiting for fs preallocator...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: lock for final commit...
Tue Mar 7 09:42:17.587 [initandlisten] shutdown: final commit...
Tue Mar 7 09:42:17.760 [initandlisten] shutdown: closing all files...
Tue Mar 7 09:42:17.760 [initandlisten] closeAllFiles() finished
Tue Mar 7 09:42:17.760 [initandlisten] journalCleanup...
Tue Mar 7 09:42:17.760 [initandlisten] removeJournalFiles
Tue Mar 7 09:42:17.969 [initandlisten] shutdown: removing fs lock...
Tue Mar 7 09:42:17.969 dbexit: really exiting now
I know the solution to kill the process (sudo killall mongod) and then run the command again but my question is :
WHY it say addr already in use when I just start the system?
Is there any way so that I do not require to run 2 command on every morning to start mongod service.
UPDATE
my guess is that mongo service start on startup as I checked with
sudo initctl list | grep mongo
which output
mongodb start/running, process 1190
now I execute below command to stop mongodb on startup
sudo update-rc.d -f mongodb remove
which output
Removing any system startup links for /etc/init.d/mongodb ...
BUt it still display the mongodb in the list when check with sudo initctl list. even I start the system again to verify?
Step 1: Sometimes starting the services in completely new terminal ctrl + alt + T works.
Step 2: Use netstat to detect the port is running or not
netstat -anp | grep mongodPortHere
If it is running then use ps aux | grep "mongod" | less for processId and use kill -9 processId
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.
Terminal displays following error:
$ mongo
MongoDB shell version: 2.4.5
connecting to: test
Wed Jul 24 14:26:45.779 JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
exception: connect failed
upon running
mongod run --config /usr/local/etc/mongod.conf
I get following error on console:
about to fork child process, waiting until server is ready for connections.
forked process: 11204
all output going to: /usr/local/var/log/mongodb/mongo.log
ERROR: child process failed, exited with error number 100
The mongo.log shows:
***** SERVER RESTARTED *****
Wed Jul 24 14:39:57.360 [initandlisten] MongoDB starting : pid=11204 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=59.161.67.13.del-cdma.dialup.vsnl.net.in
Wed Jul 24 14:39:57.363 [initandlisten]
Wed Jul 24 14:39:57.363 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Wed Jul 24 14:39:57.363 [initandlisten] db version v2.4.5
Wed Jul 24 14:39:57.363 [initandlisten] git version: a2ddc68ba7c9cee17bfe69ed840383ec3506602b
Wed Jul 24 14:39:57.363 [initandlisten] build info: Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
Wed Jul 24 14:39:57.363 [initandlisten] allocator: system
Wed Jul 24 14:39:57.363 [initandlisten] options: { bind_ip: "127.0.0.1", command: [ "run" ], config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb", fork: "true", journal: "true", logappend: "true", logpath: "/usr/local/var/log/mongodb/mongo.log", port: 27017, quiet: "true" }
Wed Jul 24 14:39:57.367 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Wed Jul 24 14:39:57.368 [initandlisten] recover : no journal files present, no recovery needed
Wed Jul 24 14:39:58.113 [initandlisten] couldn't open /usr/local/var/mongodb/test.0 errno:13 Permission denied
Wed Jul 24 14:39:58.136 [initandlisten] couldn't open /usr/local/var/mongodb/test.0 errno:13 Permission denied
Wed Jul 24 14:39:58.152 [initandlisten] exception in initAndListen: 10085 can't map file memory, terminating
Wed Jul 24 14:39:58.152 dbexit:
Wed Jul 24 14:39:58.152 [initandlisten] shutdown: going to close listening sockets...
Wed Jul 24 14:39:58.153 [initandlisten] shutdown: going to flush diaglog...
Wed Jul 24 14:39:58.153 [initandlisten] shutdown: going to close sockets...
Wed Jul 24 14:39:58.153 [initandlisten] shutdown: waiting for fs preallocator...
Wed Jul 24 14:39:58.153 [initandlisten] shutdown: lock for final commit...
Wed Jul 24 14:39:58.153 [initandlisten] shutdown: final commit...
Wed Jul 24 14:39:58.153 [initandlisten] shutdown: closing all files...
Wed Jul 24 14:39:58.154 [initandlisten] closeAllFiles() finished
Wed Jul 24 14:39:58.154 [initandlisten] journalCleanup...
Wed Jul 24 14:39:58.154 [initandlisten] removeJournalFiles
Wed Jul 24 14:39:58.154 [initandlisten] shutdown: removing fs lock...
Wed Jul 24 14:39:58.154 dbexit: really exiting now
EDIT! ( trying suggestions from answers)
running $ mongod --repair gives the following error:
$ mongod --repair
Wed Jul 24 15:16:51.596 Can't specify both --journal and --repair options.
Run the following command first to start the mongo server
mongod run --config /usr/local/etc/mongod.conf
Assuming you installed mongo using Brew.
More information about the mongod process here
EDIT
Try to repair mongo using :
mongod --repair
Seems to have issues with permissions also, try using sudo to start mongod
You need to make sure that you've actually started the server. It doesn't seem to be running here.
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
I am using Mac OS X Lion and i just did a fresh install of MongoDB using macports and when i try to run mongodb for the first time i get the following error
MongoDB shell version: 2.0.5
connecting to: test
Fri Jun 1 11:20:33 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
can anybody please help with this? thanks
when i run mongod i get:
hisham-agil:~ hisham$ mongod
mongod --help for help and startup options
Fri Jun 1 11:24:47 [initandlisten] MongoDB starting : pid=53452 port=27017 dbpath=/data/db/ 64-bit host=hisham-agil.local
Fri Jun 1 11:24:47 [initandlisten] db version v2.0.5, pdfile version 4.5
Fri Jun 1 11:24:47 [initandlisten] git version: nogitversion
Fri Jun 1 11:24:47 [initandlisten] build info: Darwin gamma.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:48:32 PST 2012; root:xnu-1699.24.23~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49
Fri Jun 1 11:24:47 [initandlisten] options: {}
Fri Jun 1 11:24:47 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating
Fri Jun 1 11:24:47 dbexit:
Fri Jun 1 11:24:47 [initandlisten] shutdown: going to close listening sockets...
Fri Jun 1 11:24:47 [initandlisten] shutdown: going to flush diaglog...
Fri Jun 1 11:24:47 [initandlisten] shutdown: going to close sockets...
Fri Jun 1 11:24:47 [initandlisten] shutdown: waiting for fs preallocator...
Fri Jun 1 11:24:47 [initandlisten] shutdown: lock for final commit...
Fri Jun 1 11:24:47 [initandlisten] shutdown: final commit...
Fri Jun 1 11:24:47 [initandlisten] shutdown: closing all files...
Fri Jun 1 11:24:47 [initandlisten] closeAllFiles() finished
Fri Jun 1 11:24:47 dbexit: really exiting now
You're running the mongo client without starting the server first. Try running mongod first.
You'll have to specify where the mongo "workspace" is using the --dbpath switch, such as mongod --dbpath /mongo/db. The specified folder should exist.
By default mongod will try to use the directory /data/db for the database files.
In your case that directory does not exist.
Before starting mongod you should create those directories and make sure they are writable by the same user that is running mongod process.
I deleted /data/db/mongod.lock to solve the problem.
I had the same issue on my mac. Try,
sudo chown -R id -u /data/db
Then start the daemon specifying your dbpath /data/db, as in bdares post above. This worked for me.