4

I'm trying to get Mongo running.

I installed the package manager Homebrew

I then used the commands located on the Mongo site:

$ brew update
$ brew install mongodb

This appeared to install correctly.
I typed mongo in a new terminal window and got the following error:

MongoDB shell version: 2.0.1
connecting to: test
Thu Dec 15 09:37:25 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed

So I then followed the instructions found on here

Ran mongod and this is the result:

mongod --help for help and startup options
Thu Dec 15 09:38:49 [initandlisten] MongoDB starting : pid=7364 port=27017 dbpath=/data/db/ 64-bit host=Mike-Fieldens-iMac.local
Thu Dec 15 09:38:49 [initandlisten] db version v2.0.1, pdfile version 4.5
Thu Dec 15 09:38:49 [initandlisten] git version: 3a5cf0e2134a830d38d2d1aae7e88cac31bdd684
Thu Dec 15 09:38:49 [initandlisten] build info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Thu Dec 15 09:38:49 [initandlisten] options: {}
Thu Dec 15 09:38:49 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating
Thu Dec 15 09:38:49 dbexit: 
Thu Dec 15 09:38:49 [initandlisten] shutdown: going to close listening sockets...
Thu Dec 15 09:38:49 [initandlisten] shutdown: going to flush diaglog...
Thu Dec 15 09:38:49 [initandlisten] shutdown: going to close sockets...
Thu Dec 15 09:38:49 [initandlisten] shutdown: waiting for fs preallocator...
Thu Dec 15 09:38:49 [initandlisten] shutdown: lock for final commit...
Thu Dec 15 09:38:49 [initandlisten] shutdown: final commit...
Thu Dec 15 09:38:49 [initandlisten] shutdown: closing all files...
Thu Dec 15 09:38:49 [initandlisten] closeAllFiles() finished
Thu Dec 15 09:38:49 dbexit: really exiting now

Notice there was an exception with "initAndListen" then it shutdown.

What am I doing wrong? How can I fix this installation and get Mongo up and running?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Mike Fielden
  • 10,055
  • 14
  • 59
  • 99

1 Answers1

8

This is the problem:

15 09:38:49 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating
Thu Dec 15 09:38:49 dbexit: 

Create the path /data/db on your system and it will work.

alessioalex
  • 62,577
  • 16
  • 155
  • 122
  • 2
    Nm... Im an idiot... I guess reading really is fundemental :) – Mike Fielden Dec 15 '11 at 15:56
  • `/data/db` will need to have write permissions from the user you run `mongod` as; you can specify an alternate data directory with the `--dbpath` command-line argument. – dcrosta Dec 15 '11 at 15:57