mongo db quits immediately - mongodb

Just started working with mongoDB. At first commands received no response, and now it immediately quits. Any ideas of what is going wrong/how I can find out whats going wrong?
Here is the terminal output:
new-host-4:~ Brennan$ mongod
all output going to: /usr/local/var/log/mongodb/mongo.log
new-host-4:~ Brennan$
Thanks!
This is the output from the log:
Sun Jun 15 21:24:50.010 [initandlisten] MongoDB starting : pid=8253 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=new-host-4.home
Sun Jun 15 21:24:50.010 [initandlisten]
Sun Jun 15 21:24:50.010 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Sun Jun 15 21:24:50.010 [initandlisten] db version v2.4.8
Sun Jun 15 21:24:50.010 [initandlisten] git version: nogitversion
Sun Jun 15 21:24:50.010 [initandlisten] build info: Darwin new-host-4.home 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_6$
Sun Jun 15 21:24:50.010 [initandlisten] allocator: tcmalloc
Sun Jun 15 21:24:50.010 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/usr/local/etc/mongod.conf", dbpath: "/usr/local/var/mongodb", logappend: "true", logpath: "/us$
Sun Jun 15 21:24:50.011 [initandlisten] journal dir=/usr/local/var/mongodb/journal
Sun Jun 15 21:24:50.011 [initandlisten] recover : no journal files present, no recovery needed
Sun Jun 15 21:24:50.026 [FileAllocator] allocating new datafile /usr/local/var/mongodb/local.ns, filling with zeroes...
Sun Jun 15 21:24:50.026 [FileAllocator] creating directory /usr/local/var/mongodb/_tmp
Sun Jun 15 21:24:50.080 [FileAllocator] done allocating datafile /usr/local/var/mongodb/local.ns, size: 16MB, took 0.054 secs
Sun Jun 15 21:24:50.085 [FileAllocator] allocating new datafile /usr/local/var/mongodb/local.0, filling with zeroes...
Sun Jun 15 21:24:50.252 [FileAllocator] done allocating datafile /usr/local/var/mongodb/local.0, size: 64MB, took 0.166 secs
Sun Jun 15 21:24:50.280 [initandlisten] command local.$cmd command: { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 reslen:37 254ms
Sun Jun 15 21:24:50.280 [websvr] admin web console waiting for connections on port 28017
Sun Jun 15 21:24:50.281 [initandlisten] waiting for connections on port 27017
Sun Jun 15 22:28:03.428 [signalProcessingThread] got signal 1 (Hangup: 1), will terminate after current cmd ends
Sun Jun 15 22:28:03.428 [signalProcessingThread] now exiting
Sun Jun 15 22:28:03.429 dbexit:
Sun Jun 15 22:28:03.429 [signalProcessingThread] shutdown: going to close listening sockets...
Sun Jun 15 22:28:03.429 [signalProcessingThread] closing listening socket: 9
Sun Jun 15 22:28:03.429 [signalProcessingThread] closing listening socket: 10
Sun Jun 15 22:28:03.429 [signalProcessingThread] closing listening socket: 11
Sun Jun 15 22:28:03.429 [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
Sun Jun 15 22:28:03.429 [signalProcessingThread] shutdown: going to flush diaglog...
Sun Jun 15 22:28:03.429 [signalProcessingThread] shutdown: going to close sockets...
Sun Jun 15 22:28:03.429 [signalProcessingThread] shutdown: waiting for fs preallocator...
Sun Jun 15 22:28:03.429 [signalProcessingThread] shutdown: lock for final commit...
Sun Jun 15 22:28:03.429 [signalProcessingThread] shutdown: final commit...
Sun Jun 15 22:28:03.437 [signalProcessingThread] shutdown: closing all files...
Sun Jun 15 22:28:03.438 [signalProcessingThread] closeAllFiles() finished
Sun Jun 15 22:28:03.438 [signalProcessingThread] journalCleanup...
Sun Jun 15 22:28:03.438 [signalProcessingThread] removeJournalFiles
Sun Jun 15 22:28:03.438 [signalProcessingThread] shutdown: removing fs lock...
Sun Jun 15 22:28:03.438 dbexit: really exiting now
It has started to stay open now but commands don't seem to do anything. Sorry, I cant narrow it down further I am new to mongodb. I'm on a mac using terminal and by typing "help" and then pressing return I should get some sort of response right?
Thanks again!

Figured it out after looking some stuff up on youtube. I was confused as I was coming from a MYSQL background. mongodstarts the server but you need to use mongo to access the shell (I just opened a new terminal wind

Related

Getting "signal 15 (Terminated), will terminate after current cmd ends" and Mongodb shutting down? Fork condition is not mentioned in config [duplicate]

my mongodb server suddenly got signal 15 (Terminated). I don't have any idea why the mongodb crashed. Below is the log messages.
Mon Jun 27 07:33:31.701 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
Mon Jun 27 07:33:31.704 [signalProcessingThread] now exiting
Mon Jun 27 07:33:31.704 dbexit:
Mon Jun 27 07:33:31.704 [signalProcessingThread] shutdown: going to close listening sockets...
Mon Jun 27 07:33:31.704 [signalProcessingThread] closing listening socket: 9
Mon Jun 27 07:33:31.704 [signalProcessingThread] closing listening socket: 10
Mon Jun 27 07:33:31.704 [signalProcessingThread] closing listening socket: 11
Mon Jun 27 07:33:31.705 [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
Mon Jun 27 07:33:31.705 [signalProcessingThread] shutdown: going to flush diaglog...
Mon Jun 27 07:33:31.705 [signalProcessingThread] shutdown: going to close sockets...
Mon Jun 27 07:33:31.706 [signalProcessingThread] shutdown: waiting for fs preallocator...
Mon Jun 27 07:33:31.706 [signalProcessingThread] shutdown: lock for final commit...
Mon Jun 27 07:33:31.706 [signalProcessingThread] shutdown: final commit...
Below is restart process.
***** SERVER RESTARTED *****
Mon Jun 27 07:34:22.500 [initandlisten] MongoDB starting : pid=888 port=27017 dbpath=/var/lib/mongodb 64-bit host=jasa-online
Mon Jun 27 07:34:22.500 [initandlisten] db version v2.4.9
Mon Jun 27 07:34:22.500 [initandlisten] git version: nogitversion
Mon Jun 27 07:34:22.500 [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
Mon Jun 27 07:34:22.500 [initandlisten] allocator: tcmalloc
Mon Jun 27 07:34:22.500 [initandlisten] options: { bind_ip: "0.0.0.0", config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", journal: "true", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Mon Jun 27 07:34:22.531 [initandlisten] journal dir=/var/lib/mongodb/journal
Mon Jun 27 07:34:22.531 [initandlisten] recover : no journal files present, no recovery needed
The MongoDB shell version is 2.4.9. How can i figured out why this is happen ? Is that caused by long running query that run more than 300s ?
I know this is old, but I was running into the issue and stumbled across this question. I managed to solve it.
My issue was on Ubuntu 18.04 and attempting to install and run MongoDB 3.4/3.6.
One issue was a missing /var/run/mongodb directory with the appropriate permissions, the other was this error. I'm still not 100% sure if this error was related to the directory or not, but it definitely had something to do with the configs.
My mongod.conf ended up having processManagement - fork set to true. Changing that to false allowed it to start working.
I solved this problem after including the PID file path in mongod.conf.
It was like this:
processManagement:
timeZoneInfo: /usr/share/zoneinfo
fork: true
pidFilePath: /var/run/mongodb/mongod.pid
In my case, I had put "fork: true", but I hadn't included the PID file path.
make sure path confing in /usr/lib/systemd/system/mongod.service
and /etc/mongod.conf the same
If are you using MongoDB version below 3.0, Please upgrade to 3.2 or latest version.
Refer: https://jira.mongodb.org/browse/SERVER-24282

Mongodb crash got signal 15 (Terminated)

my mongodb server suddenly got signal 15 (Terminated). I don't have any idea why the mongodb crashed. Below is the log messages.
Mon Jun 27 07:33:31.701 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
Mon Jun 27 07:33:31.704 [signalProcessingThread] now exiting
Mon Jun 27 07:33:31.704 dbexit:
Mon Jun 27 07:33:31.704 [signalProcessingThread] shutdown: going to close listening sockets...
Mon Jun 27 07:33:31.704 [signalProcessingThread] closing listening socket: 9
Mon Jun 27 07:33:31.704 [signalProcessingThread] closing listening socket: 10
Mon Jun 27 07:33:31.704 [signalProcessingThread] closing listening socket: 11
Mon Jun 27 07:33:31.705 [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
Mon Jun 27 07:33:31.705 [signalProcessingThread] shutdown: going to flush diaglog...
Mon Jun 27 07:33:31.705 [signalProcessingThread] shutdown: going to close sockets...
Mon Jun 27 07:33:31.706 [signalProcessingThread] shutdown: waiting for fs preallocator...
Mon Jun 27 07:33:31.706 [signalProcessingThread] shutdown: lock for final commit...
Mon Jun 27 07:33:31.706 [signalProcessingThread] shutdown: final commit...
Below is restart process.
***** SERVER RESTARTED *****
Mon Jun 27 07:34:22.500 [initandlisten] MongoDB starting : pid=888 port=27017 dbpath=/var/lib/mongodb 64-bit host=jasa-online
Mon Jun 27 07:34:22.500 [initandlisten] db version v2.4.9
Mon Jun 27 07:34:22.500 [initandlisten] git version: nogitversion
Mon Jun 27 07:34:22.500 [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
Mon Jun 27 07:34:22.500 [initandlisten] allocator: tcmalloc
Mon Jun 27 07:34:22.500 [initandlisten] options: { bind_ip: "0.0.0.0", config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", journal: "true", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }
Mon Jun 27 07:34:22.531 [initandlisten] journal dir=/var/lib/mongodb/journal
Mon Jun 27 07:34:22.531 [initandlisten] recover : no journal files present, no recovery needed
The MongoDB shell version is 2.4.9. How can i figured out why this is happen ? Is that caused by long running query that run more than 300s ?
I know this is old, but I was running into the issue and stumbled across this question. I managed to solve it.
My issue was on Ubuntu 18.04 and attempting to install and run MongoDB 3.4/3.6.
One issue was a missing /var/run/mongodb directory with the appropriate permissions, the other was this error. I'm still not 100% sure if this error was related to the directory or not, but it definitely had something to do with the configs.
My mongod.conf ended up having processManagement - fork set to true. Changing that to false allowed it to start working.
I solved this problem after including the PID file path in mongod.conf.
It was like this:
processManagement:
timeZoneInfo: /usr/share/zoneinfo
fork: true
pidFilePath: /var/run/mongodb/mongod.pid
In my case, I had put "fork: true", but I hadn't included the PID file path.
make sure path confing in /usr/lib/systemd/system/mongod.service
and /etc/mongod.conf the same
If are you using MongoDB version below 3.0, Please upgrade to 3.2 or latest version.
Refer: https://jira.mongodb.org/browse/SERVER-24282

MongoDb Bind_ip error: bind() failed errno:10049

My MongoDb Config file Content Is as below:
port=22000
bind_ip=127.0.0.1,192.168.1.121
auth=true
dbpath=D:\Data_For_Mongo
I am running my mongod instance using following command:
mongod -f "D:\mongoConfig.conf"
It Gives Me following Error:
ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 192.168.1.121:22000
The Whole Stack trace is As Below:
Fri Apr 11 09:24:18.600 [initandlisten] MongoDB starting : pid=3780 port=22000 dbpath=D:\Data_For_Mongo 64-bit host=SLK055
Fri Apr 11 09:24:18.600 [initandlisten] db version v2.4.6
Fri Apr 11 09:24:18.600 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Fri Apr 11 09:24:18.600 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Fri Apr 11 09:24:18.615 [initandlisten] allocator: system
Fri Apr 11 09:24:18.615 [initandlisten] options: { auth: "true", bind_ip: "192.168.1.80,192.168.1.121", config: "D:\mongoConfig.conf", dbpath: "D:\Data_For_Mongo", port: 22000 }
Fri Apr 11 09:24:18.647 [initandlisten] journal dir=D:\Data_For_Mongo\journal
Fri Apr 11 09:24:18.647 [initandlisten] recover : no journal files present, no recovery needed
Fri Apr 11 09:24:18.709 [initandlisten] ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 192.168.1.121:22000
Fri Apr 11 09:24:18.709 [websvr] ERROR: listen(): bind() failed errno:10049 The requested address is not valid in its context. for socket: 192.168.1.121:23000
Fri Apr 11 09:24:18.709 [initandlisten] now exiting
Fri Apr 11 09:24:18.725 dbexit:
Fri Apr 11 09:24:18.725 [initandlisten] shutdown: going to close listening sockets...
Fri Apr 11 09:24:18.740 [initandlisten] closing listening socket: 528
Fri Apr 11 09:24:18.740 [initandlisten] closing listening socket: 552
Fri Apr 11 09:24:18.740 [initandlisten] shutdown: going to flush diaglog...
Fri Apr 11 09:24:18.756 [initandlisten] shutdown: going to close sockets...
Fri Apr 11 09:24:18.756 [initandlisten] shutdown: waiting for fs preallocator...
Fri Apr 11 09:24:18.772 [initandlisten] shutdown: lock for final commit...
Fri Apr 11 09:24:18.772 [initandlisten] shutdown: final commit...
Fri Apr 11 09:24:18.834 [initandlisten] shutdown: closing all files...
Fri Apr 11 09:24:18.834 [initandlisten] closeAllFiles() finished
Fri Apr 11 09:24:18.834 [initandlisten] journalCleanup...
Fri Apr 11 09:24:18.834 [initandlisten] removeJournalFiles
Fri Apr 11 09:24:18.850 [initandlisten] shutdown: removing fs lock...
Fri Apr 11 09:24:18.850 dbexit: really exiting now
Bind Multiple ips is important for me.
Can AnyOne Help Me To Solve This Error?
I Have searched about error but can't find any way to bind multiple ips in mongo.
Thats a Windows Socket error. This is normally due to the IP address you are trying to bind to not being the IP of your local machine. You should double check that your system actually has the IP of 192.168.1.121

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

mongod shell doesn't start, data/db doesn't exsist

When I start mongod trowed error. What is the problem?
root#cs12867:~# mongod
mongod --help for help and startup options
Sun Dec 22 15:37:44.081 [initandlisten] MongoDB starting : pid=18415 port=27017 dbpath=/data/db/ 64-bit host=cs12867
Sun Dec 22 15:37:44.081 [initandlisten] db version v2.4.6
Sun Dec 22 15:37:44.081 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Sun Dec 22 15:37:44.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 Dec 22 15:37:44.081 [initandlisten] allocator: tcmalloc
Sun Dec 22 15:37:44.081 [initandlisten] options: {}
Sun Dec 22 15:37:44.081 [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
Sun Dec 22 15:37:44.081 dbexit:
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: going to close listening sockets...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: going to flush diaglog...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: going to close sockets...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: waiting for fs preallocator...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: lock for final commit...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: final commit...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: closing all files...
Sun Dec 22 15:37:44.081 [initandlisten] closeAllFiles() finished
Sun Dec 22 15:37:44.081 dbexit: really exiting now
I set --dbpath:
root#cs12867:~# mongod --dbpath /var/lib/mongodb/data/db
Sun Dec 22 15:29:25.121 [initandlisten] MongoDB starting : pid=17739 port=27017 dbpath=/var/lib/mongodb/data/db 64-bit host=cs12867
Sun Dec 22 15:29:25.121 [initandlisten] db version v2.4.6
Sun Dec 22 15:29:25.121 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Sun Dec 22 15:29:25.121 [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 Dec 22 15:29:25.121 [initandlisten] allocator: tcmalloc
Sun Dec 22 15:29:25.121 [initandlisten] options: { dbpath: "/var/lib/mongodb/data/db" }
Sun Dec 22 15:29:25.121 [initandlisten]
Sun Dec 22 15:29:25.121 [initandlisten] ** WARNING: Readahead for /var/lib/mongodb/data/db is set to 2048KB
Sun Dec 22 15:29:25.121 [initandlisten] ** We suggest setting it to 256KB (512 sectors) or less
Sun Dec 22 15:29:25.121 [initandlisten] ** http://dochub.mongodb.org/core/readahead
Sun Dec 22 15:29:25.123 [initandlisten] journal dir=/var/lib/mongodb/data/db/journal
Sun Dec 22 15:29:25.123 [initandlisten] recover : no journal files present, no recovery needed
Sun Dec 22 15:29:25.134 [initandlisten] waiting for connections on port 27017
Sun Dec 22 15:29:25.134 [websvr] admin web console waiting for connections on port 28017
Sun Dec 22 15:29:26.179 [initandlisten] connection accepted from 127.0.0.1:37164 #1 (1 connection now open)
Sun Dec 22 15:29:26.179 [FileAllocator] allocating new datafile /var/lib/mongodb/data/db/Tester.ns, filling with zeroes...
Sun Dec 22 15:29:26.179 [FileAllocator] creating directory /var/lib/mongodb/data/db/_tmp
Sun Dec 22 15:29:26.181 [FileAllocator] done allocating datafile /var/lib/mongodb/data/db/Tester.ns, size: 16MB, took 0 secs
Sun Dec 22 15:29:26.181 [FileAllocator] allocating new datafile /var/lib/mongodb/data/db/Tester.0, filling with zeroes...
Sun Dec 22 15:29:26.181 [FileAllocator] done allocating datafile /var/lib/mongodb/data/db/Tester.0, size: 64MB, took 0 secs
Sun Dec 22 15:29:26.182 [FileAllocator] allocating new datafile /var/lib/mongodb/data/db/Tester.1, filling with zeroes...
Sun Dec 22 15:29:26.182 [FileAllocator] done allocating datafile /var/lib/mongodb/data/db/Tester.1, size: 128MB, took 0 secs
Sun Dec 22 15:29:26.184 [conn1] build index Tester.user { _id: 1 }
Sun Dec 22 15:29:26.184 [conn1] build index done. scanned 0 total records. 0 secs
Sun Dec 22 15:29:26.184 [conn1] end connection 127.0.0.1:37164 (0 connections now open)
Sun Dec 22 15:29:26.192 [initandlisten] connection accepted from 127.0.0.1:37165 #2 (1 connection now open)
Sun Dec 22 15:29:26.732 [initandlisten] connection accepted from 127.0.0.1:37166 #3 (2 connections now open)
Sun Dec 22 15:29:26.733 [conn3] end connection 127.0.0.1:37166 (1 connection now open)
Sun Dec 22 15:29:26.740 [initandlisten] connection accepted from 127.0.0.1:37167 #4 (2 connections now open)
Sun Dec 22 15:29:26.740 [conn4] end connection 127.0.0.1:37167 (1 connection now open)
Sun Dec 22 15:29:26.834 [initandlisten] connection accepted from 127.0.0.1:37168 #5 (2 connections now open)
Sun Dec 22 15:29:26.835 [conn5] end connection 127.0.0.1:37168 (1 connection now open)
Sun Dec 22 15:29:26.843 [initandlisten] connection accepted from 127.0.0.1:37169 #6 (2 connections now open)
Sun Dec 22 15:29:27.252 [initandlisten] connection accepted from 127.0.0.1:37170 #7 (3 connections now open)
Sun Dec 22 15:29:27.253 [conn7] end connection 127.0.0.1:37170 (2 connections now open)
Sun Dec 22 15:29:27.304 [initandlisten] connection accepted from 127.0.0.1:37171 #8 (3 connections now open)
Sun Dec 22 15:29:27.304 [conn8] end connection 127.0.0.1:37171 (2 connections now open)
Sun Dec 22 15:29:28.332 [initandlisten] connection accepted from 127.0.0.1:37173 #9 (3 connections now open)
Sun Dec 22 15:29:28.333 [conn9] end connection 127.0.0.1:37173 (2 connections now open)
Sun Dec 22 15:29:28.352 [initandlisten] connection accepted from 127.0.0.1:37174 #10 (3 connections now open)
Sun Dec 22 15:29:28.842 [conn10] end connection 127.0.0.1:37174 (2 connections now open)
Sun Dec 22 15:29:28.862 [initandlisten] connection accepted from 127.0.0.1:37176 #11 (3 connections now open)
Sun Dec 22 15:29:28.863 [conn11] end connection 127.0.0.1:37176 (2 connections now open)
Sun Dec 22 15:29:30.362 [initandlisten] connection accepted from 127.0.0.1:37178 #12 (3 connections now open)
Sun Dec 22 15:29:30.363 [initandlisten] connection accepted from 127.0.0.1:37179 #13 (4 connections now open)
Sun Dec 22 15:29:30.364 [conn13] end connection 127.0.0.1:37179 (3 connections now open)
Sun Dec 22 15:37:36.523 [signalProcessingThread] shutdown: closing all files...
Sun Dec 22 15:37:36.523 [signalProcessingThread] closeAllFiles() finished
Sun Dec 22 15:37:36.523 [signalProcessingThread] journalCleanup...
Sun Dec 22 15:37:36.523 [signalProcessingThread] removeJournalFiles
Sun Dec 22 15:37:36.525 [signalProcessingThread] shutdown: removing fs lock...
Sun Dec 22 15:37:36.525 dbexit: really exiting now
Then again:
root#cs12867:~# mongod
mongod --help for help and startup options
Sun Dec 22 15:37:44.081 [initandlisten] MongoDB starting : pid=18415 port=27017 dbpath=/data/db/ 64-bit host=cs12867
Sun Dec 22 15:37:44.081 [initandlisten] db version v2.4.6
Sun Dec 22 15:37:44.081 [initandlisten] git version: b9925db5eac369d77a3a5f5d98a145eaaacd9673
Sun Dec 22 15:37:44.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 Dec 22 15:37:44.081 [initandlisten] allocator: tcmalloc
Sun Dec 22 15:37:44.081 [initandlisten] options: {}
Sun Dec 22 15:37:44.081 [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
Sun Dec 22 15:37:44.081 dbexit:
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: going to close listening sockets...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: going to flush diaglog...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: going to close sockets...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: waiting for fs preallocator...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: lock for final commit...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: final commit...
Sun Dec 22 15:37:44.081 [initandlisten] shutdown: closing all files...
Sun Dec 22 15:37:44.081 [initandlisten] closeAllFiles() finished
Sun Dec 22 15:37:44.081 dbexit: really exiting now
The default db path for mongodb is /data/db/.
So when you run:
mongod
MongoDB checks if /data/db/ is present and if the user has access to it. In your case, there is no such directory and hence the error.
However you can override the default db path using the --dbpath argument of mongod( or use a config file).
mongod --dbpath /var/lib/mongodb/data/db
In this case instead of checking for /data/db/ mongoDB check for /var/lib/mongodb/data/db. In your case, you have the specified directory and you have access to it and hence it runs.
And doing this doesn't start the mongo shell. To start the shell, start mongod first as mentioned above and leave it running. Then in another terminal execute
mongo
This will start the mongo shell.
As I see from the problem that creating the data/db directory will fix your problem.
Create that and then add like this if you have directory path in c drive.
mongod --dbpath "c://data/db"
After setting the dbpath you should start the mongodb as service.
sudo service mongodb start
Another solution to that problem could be:
.
Delete the files inside of /data/journal/ or /data/db/journal/
.
Especially if your database stopped working after an unclean restart / crash. It seems that the journal files can get corrupted and block the mongo service from starting.
Remember to backup the files first just in case.
Following these posts:
https://stackoverflow.com/a/16323101
https://jira.mongodb.org/browse/SERVER-5380