MongoDb连接被拒绝

编程入门 行业动态 更新时间:2024-10-27 22:25:09
本文介绍了MongoDb连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是我第一次尝试使用MongoDB.我让Mongo运行了:

This is my first attempt to consume MongoDB. I've got Mongo running:

ps -ef | grep [m]ongo mongodb 11023 1 0 Jun24 ? 00:00:03 /usr/lib/mongodb/mongod --config /etc/mongodb.conf

错误是这样做的结果

Datastore.save( stuff ); // (pseudo code)

错误:

Jun 27, 2011 3:20:29 PM com.mongodb.DBTCPConnector fetchMaxBsonObjectSize WARNING: Exception determining maxBSON size using0 java.io.IOException: couldn't connect to [russ-elite-book/127.0.1.1:27017] bc:java.ConnectException: Connection refused at com.mongodb.DBPort._open(DBPort.java:206) at com.mongodb.DBPort.go(DBPort.java:94) at com.mongodb.DBPort.go(DBPort.java:75) at com.mongodb.DBPort.findOne(DBPort.java:129) at com.mongodb.DBPort.runCommand(DBPort.java:138) ...

请注意,我正在使用 127.0.0.1:27017 进行连接,该连接适用于Mongo shell.另外,我使用 localhost:28017 在浏览器中获得管理页面.

Note that I'm using 127.0.0.1:27017 for my connection, which works to the Mongo shell. Also, I get the admin page in the browser using localhost:28017.

对任何想法表示感谢!

推荐答案

(我认为回答自己的问题有点差劲,但实际上,答案没有一个建议.尽管如此,但我非常感谢回答一个问题时,一个人必须能够假定它基于正确安装且正在运行的软件.我没有那个.)

(I think it slightly bad form to answer one's own question, but in fact, the answer turns out to be none of those suggested. Nevertheless, my profuse thanks to all of them. When answering a question, one needs to be able to assume it's based on correctly installed and working software. I did not have that.)

我使用Ubuntu软件中心安装了MongoDB.如问题中其他地方所述,它是从外壳程序和浏览器运行的.但是,它不适用于Java(也不适用于Django).

I installed MongoDB using the Ubuntu Software Center. It worked from the shell and from the browser as noted elsewhere in this question. However, it did not work from Java (nor from Django either).

尽管它在Java堆栈跟踪中说了什么,但问题只是连接被拒绝".

The problem, despite what it said in the Java stack trace, was simply "connection refused."

解决方案是从正确的Mongo来源安装它,而不是信任Ubuntu存储库.

(是的,从Eclipse那里获得的其他产品也经常发生这种情况,但是您知道它是一种很好的服务,因此您要信任它.)

(Yes, this also frequently happens to other products obtain from there too, like Eclipse, but you know it's such a nice service that you want to trust it.)

如果您想阅读我如何安装然后工作的软件,请查看 www.javahotchocolate/tutorials /mongodb.html .

If you want to read how I installed what then worked, check out www.javahotchocolate/tutorials/mongodb.html.

更多推荐

MongoDb连接被拒绝

本文发布于:2023-10-16 10:09:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497266.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:被拒   MongoDb

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!