收到错误消息,“错误:无法连接到服务器127.0.0.1 shell/mongo.js" &尝试在Mac OS X Lion上运行mongodb时 [英] Getting an error, "Error: couldn't connect to server 127.0.0.1 shell/mongo.js" & when trying to run mongodb on mac osx lion

查看:132
本文介绍了收到错误消息,“错误:无法连接到服务器127.0.0.1 shell/mongo.js" &尝试在Mac OS X Lion上运行mongodb时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mac OS X Lion,我只是使用macports重新安装了MongoDB,当我第一次尝试运行mongodb时,出现以下错误

I am using Mac OS X Lion and i just did a fresh install of MongoDB using macports and when i try to run mongodb for the first time i get the following error

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时,我得到了:

when i run mongod i get:

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.

You're running the mongo client without starting the server first. Try running mongod first.

您必须使用--dbpath开关指定mongo工作区"的位置,例如mongod --dbpath /mongo/db.指定的文件夹应该存在.

You'll have to specify where the mongo "workspace" is using the --dbpath switch, such as mongod --dbpath /mongo/db. The specified folder should exist.

这篇关于收到错误消息,“错误:无法连接到服务器127.0.0.1 shell/mongo.js" &尝试在Mac OS X Lion上运行mongodb时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆