第一次弄,在本论坛某位 github 上下的一个 rails 项目,需要 mongo 数据库,我用 brew 安装的。参照官方文档说如果我正确安装 brew 的话,那么 mongo 的路径是自动被正确添加的,但是我运行:
➜ ~ mongo
或者:
➜ ~ mongod
返回以下结果:
➜ ~ mongo
MongoDB shell version: 2.0.6
connecting to: test
Tue Jul 24 09:00:56 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
➜ ~ mongod
mongod --help for help and startup options
Tue Jul 24 09:01:12 [initandlisten] MongoDB starting : pid=89996 port=27017 dbpath=/data/db/ 64-bit host=Yuwen.local
Tue Jul 24 09:01:12 [initandlisten] db version v2.0.6, pdfile version 4.5
Tue Jul 24 09:01:12 [initandlisten] git version: e1c0cbc25863f6356aa4e31375add7bb49fb05bc
Tue Jul 24 09:01:12 [initandlisten] build info: Darwin erh2.10gen.cc 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Tue Jul 24 09:01:12 [initandlisten] options: {}
Tue Jul 24 09:01:12 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating
Tue Jul 24 09:01:12 dbexit:
Tue Jul 24 09:01:12 [initandlisten] shutdown: going to close listening sockets...
Tue Jul 24 09:01:12 [initandlisten] shutdown: going to flush diaglog...
Tue Jul 24 09:01:12 [initandlisten] shutdown: going to close sockets...
Tue Jul 24 09:01:12 [initandlisten] shutdown: waiting for fs preallocator...
Tue Jul 24 09:01:12 [initandlisten] shutdown: lock for final commit...
Tue Jul 24 09:01:12 [initandlisten] shutdown: final commit...
Tue Jul 24 09:01:12 [initandlisten] shutdown: closing all files...
Tue Jul 24 09:01:12 [initandlisten] closeAllFiles() finished
Tue Jul 24 09:01:12 dbexit: really exiting now
➜ ~