[英]MongoDB start error
I have problem to run Mongodb on my OSX. 我在OSX上运行Mongodb时遇到问题。 I have installed with brew and when I'm trying to start Mongodb server and type mongo and then run it getting me error:
我已经安装了brew,并且在尝试启动Mongodb服务器并键入mongo然后运行它时得到错误:
$ mongo
MongoDB shell version: 3.0.7
connecting to: test
2015-11-17T12:56:16.793+0100 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-11-17T12:56:16.794+0100 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
Can you please give me some useful advices? 您能给我一些有用的建议吗? Thanks in advance.
提前致谢。
mongo
is the client shell, it's not a server. mongo
是客户端外壳,不是服务器。 You start a MongoDB server with the mongod
command. 使用
mongod
命令启动MongoDB服务器。 For example: 例如:
mongod --dbpath ~/mongodb/data
You can also start mongod
automatically when your OS starts up. 您也可以在操作系统启动时自动启动
mongod
。 You can find instructions here: https://stackoverflow.com/a/17061202/236660 您可以在此处找到说明: https : //stackoverflow.com/a/17061202/236660
After the server is started, you can use mongo
to connect to the server. 服务器启动后,您可以使用
mongo
连接到服务器。
Note that you can also run the mongo shell without connecting to any server: 请注意,您也可以在不连接任何服务器的情况下运行mongo shell:
mongo --nodb
Of course, you won't be able to do much with just the shell. 当然,仅使用shell就无法做很多事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.