我正在使用Mac OS X Lion,我刚刚使用macports进行了全新的MongoDB安装,当我第一次尝试运行
mongodb时出现以下错误
MongoDB shell version: 2.0.5 connecting to: test Fri Jun 1 11:20:33 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84 exception: connect Failed
任何人都可以帮忙吗?谢谢
当我运行mongod我得到:
hisham-agil:~ hisham$mongod mongod --help for help and startup options Fri Jun 1 11:24:47 [initandlisten] MongoDB starting : pid=53452 port=27017 dbpath=/data/db/ 64-bit host=hisham-agil.local Fri Jun 1 11:24:47 [initandlisten] db version v2.0.5,pdfile version 4.5 Fri Jun 1 11:24:47 [initandlisten] git version: nogitversion Fri Jun 1 11:24:47 [initandlisten] build info: Darwin gamma.local 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:48:32 PST 2012; root:xnu-1699.24.23~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_49 Fri Jun 1 11:24:47 [initandlisten] options: {} Fri Jun 1 11:24:47 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist,terminating Fri Jun 1 11:24:47 dbexit: Fri Jun 1 11:24:47 [initandlisten] shutdown: going to close listening sockets... Fri Jun 1 11:24:47 [initandlisten] shutdown: going to flush diaglog... Fri Jun 1 11:24:47 [initandlisten] shutdown: going to close sockets... Fri Jun 1 11:24:47 [initandlisten] shutdown: waiting for fs preallocator... Fri Jun 1 11:24:47 [initandlisten] shutdown: lock for final commit... Fri Jun 1 11:24:47 [initandlisten] shutdown: final commit... Fri Jun 1 11:24:47 [initandlisten] shutdown: closing all files... Fri Jun 1 11:24:47 [initandlisten] closeAllFiles() finished Fri Jun 1 11:24:47 dbexit: really exiting now
您在没有首先启动服务器的情况下运行mongo客户端.首先尝试运行mongod.
原文链接:https://www.f2er.com/bash/384238.html您必须指定mongo“workspace”使用–dbpath开关的位置,例如mongod –dbpath / mongo / db.指定的文件夹应该存在.