我正在努力让Mongo跑步。
我安装了包管理器Homebrew
然后我使用了位于Mongo网站上的命令:
$ brew update
$ brew install mongodb
这似乎安装正确。
我在新的终端窗口中键入mongo
并收到以下错误:
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
然后我按照here
上的说明进行操作跑mongod
,这就是结果:
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
注意“initAndListen”存在异常,然后关闭。
我做错了什么?如何修复此安装并使Mongo启动并运行?
答案 0 :(得分:8)
这是问题所在:
15 09:38:49 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating
Thu Dec 15 09:38:49 dbexit:
在您的系统上创建路径/data/db
,它将起作用。