I am using MongoDB on OSX. I am following along with a book.
MongoDB: The Definitive Guide, Second Edition
I have MongoDB
installed and running. I have made a few collections
with some values
in them.
I installed using Homebrew
When I run mongo
in the terminal my shell starts and I can use it fine.
When I run mongod
I get an error stating a do not have a data/db directory. I know this is because the default location for mongo
to store data is inside that directory but homebrew
sets its own path up.
When I run
Home:~ ThisIsMe$ mongo
MongoDB shell version: 2.6.3
connecting to: test
> db.serverCmdLineOpts()
{
"argv" : [
"/usr/local/opt/mongodb/bin/mongod",
"--config",
"/usr/local/etc/mongod.conf"
],
"parsed" : {
"config" : "/usr/local/etc/mongod.conf",
"net" : {
"bindIp" : "127.0.0.1"
},
"storage" : {
"dbPath" : "/usr/local/var/mongodb"
},
"systemLog" : {
"destination" : "file",
"logAppend" : true,
"path" : "/usr/local/var/log/mongodb/mongo.log"
}
},
"ok" : 1
}
>
I get those file paths where homebrew
set my mongo up at.
I want to make sure everything is set up correctly. Do I need to add something else to be able to run mongod
without errors? I am under the impression I should be able to run mongod
then go to http://localhost:28017/
to see information about my mongo.
But I cannot get mongod to run without the errors about data/db
Home:~ ThisIsMe$ mongod
mongod --help for help and startup options
2014-07-24T13:09:07.817-0500 [initandlisten] MongoDB starting : pid=1668 port=27017 dbpath=/data/db 64-bit host=NichoDiaz
2014-07-24T13:09:07.817-0500 [initandlisten]
2014-07-24T13:09:07.817-0500 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2014-07-24T13:09:07.817-0500 [initandlisten] db version v2.6.3
2014-07-24T13:09:07.817-0500 [initandlisten] git version: nogitversion
2014-07-24T13:09:07.817-0500 [initandlisten] build info: Darwin minimavericks.local 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2014-07-24T13:09:07.818-0500 [initandlisten] allocator: tcmalloc
2014-07-24T13:09:07.818-0500 [initandlisten] options: {}
2014-07-24T13:09:07.818-0500 [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
2014-07-24T13:09:07.818-0500 [initandlisten] dbexit:
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: going to close listening sockets...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: going to flush diaglog...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: going to close sockets...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: waiting for fs preallocator...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: lock for final commit...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: final commit...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: closing all files...
2014-07-24T13:09:07.818-0500 [initandlisten] closeAllFiles() finished
2014-07-24T13:09:07.818-0500 [initandlisten] dbexit: really exiting now
Home:~ ThisIsMe$