如何连接到MongoDB的在Azure上,来自Android的? [英] How to connect to MongoDB on Azure, from Android?

查看:157
本文介绍了如何连接到MongoDB的在Azure上,来自Android的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有任何人有关于如何在Android应用程序连接到MongoDB的在Azure上运行的角色的细节?

Does anybody have specifics on how to connect an Android application to MongoDB running on Azure roles?

-

您好,我有在云服务Azure的多重角色的MongoDB运行副本集。我已经使用在GitHub上蒙戈 - 蔚蓝库来创建角色实例,让他们在Azure中运行

Hi, I have MongoDB replica set running on multiple Azure roles in the Cloud Service. I have used the mongo-azure library on GitHub to create the role instances and have them running in Azure.

大多数文章在网上似乎只谈连接到Azure的MongoDB的本地(通过本地主机)。但是,因为我的申请将不会被天青本地运行,我觉得我必须使用REST以某种方式连接到Azure云服务器,这可能会或可能不会传播数据到MongoDB的副本集。

Most articles online seem to only talk about connecting to Azure-MongoDB locally (via localhost). But, since my application won't be running locally to Azure, I feel that I have to use REST to somehow connect to Azure cloud servers, which may or may not propagate data to the MongoDB replica set.

是否有人对如何将Android应用程序连接到Azure上运行的角色MongoDB的更多的细节?

Does anybody have more specifics on how to connect an Android application to MongoDB running on Azure roles?

(或者,对于那些没有与Android / Java的经验:如何从非本地主机使用non-.NET连接)

(Or, for those that don't have experience with Android/Java: how to connect from non-localhost using non-.NET?)

PS - 在其他MongoDB的问题,人们已经回答了Android是没有原生支持的MongoDB,并使用非本地方法,通过我的罚款。有应用程序在那里,已经做到这一点,主要是四方。不幸的是,他们使用AWS,而不是Azure的(对我的要求)。

ps - In other MongoDB questions, people have already answered Android is not natively support by MongoDB, and using non-native methods is fine by me. There are apps out there that already do this, mainly Foursquare. Unfortunately, they use AWS instead of Azure (the requirement for me).

PPS - 如果任何人有关于它如何工作的更详细条款的链接蒙戈 - 库的任何更多的资源,那么这将是非常有益的太

pps - if anybody has any more resources for the linked mongo-library about how it works in more detailed terms, then that would be very helpful too.

更新


  • 我找到了最先进的最新版本的 mongo- Java的driver.jar (目前2.11.3),并正在测试这一点。

  • 感谢<一个href=\"http://stackoverflow.com/questions/11433091/how-connect-mongo-db-with-android-application\">another问题我已经找到了特定的问题与Android不被支持Java驱动程序,但这个问题似乎得到解决。

  • I found the most up-to-date version of mongo-java-driver.jar (currently 2.11.3) and am testing that.
  • Thanks to another question I've found the particular issue with Android not supported by the java driver, but that issue appears to be resolved.

可能的解决方案


  • 在Visual Studio项目,我创建了角色的输入端点。到目前为止,似乎这样的伎俩,用 MongoClient蒙戈=新MongoClient(&LT;&MY_IP_ADDRESS GT;,27017);

  • In the Visual Studio project, I created an Input Endpoint for the role. So far that seems to do the trick, using MongoClient mongo = new MongoClient("<my_ip_address>", 27017);

推荐答案

您'可能的解决方案,在我看来是正确的 - 你需要在防火墙中打开(负载平衡)的TCP端口围绕你的角色和<一个HREF =htt​​p://msdn.microsoft.com/en-us/library/windowsazure/gg433020.aspx相对=nofollow> InputEndpoint 是做到这一点的方式。

Your 'possible solution' is the right one in my view - you need to open a (load balanced) TCP port in the firewall surrounding your roles and InputEndpoint is the way to do that.

这篇关于如何连接到MongoDB的在Azure上,来自Android的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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