通过Java接口远程访问ArangoDB [英] Remote access to ArangoDB through Java Interface

查看:250
本文介绍了通过Java接口远程访问ArangoDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个使用ArangoDB作为后端数据库的Java应用程序(使用ArangoDB Java-Driver/Interface访问ArangoDB).

I have developed a Java application that uses ArangoDB as backend database (Used ArangoDB Java-Driver/Interface to access ArangoDB).

一切都很好,直到我的ArangoDB和应用程序驻留在同一台计算机上.

Everything is good until my ArangoDB and Application resides on same machine.

一旦我将ArangoDB移至远程计算机(专用服务器),我的应用程序将无法访问它:(

Once i moved ArangoDB to remote machine(Dedicated Server), my application is unable to access it :(

我在一些属性文件中提供了我的远程计算机详细信息(ArangoDB服务器),并在创建ArangoDriver对象时将该文件位置提供给ArangoConfigure构造函数.但是我仍然无法访问ArangoDB:(

I have given my remote machine details(ArangoDB Server) in some properties file and feeding that file location to ArangoConfigure Constructor while creating ArangoDriver Object. But still i'm unable to access ArangoDB :(

我的代码的小片段如下:

Small snippet of my code is below:

protected static ArangoConfigure getConfiguration() {
        //ArangoConfigure configure = new ArangoConfigure();
        ArangoConfigure configure = new
ArangoConfigure("/Volumes/Official/ZLabs/arangodb.properties");
                configure.init();

        return configure;   }

    protected static ArangoDriver getArangoDriver(ArangoConfigure
configuration) {        return new ArangoDriver(configuration);     }

在这方面请帮助我.

等待您的答复.

感谢&最好的祝福, -Mahi

Thanks & Best Regards, - Mahi

推荐答案

如果Aranngodb Java驱动程序无法打开或解析/Volumes/Official/ZLabs/arangodb.properties,它将发出一条日志消息.

If the Aranngodb Java driver fails to open or parse /Volumes/Official/ZLabs/arangodb.properties it issues a log message.

如果arangodb属性如下所示:

If arangodb properties looks like that:

port=8529
host=192.168.22.17
user=root
password=OpenSesame
enableCURLLogger=false

您开始浏览OSI模型调试TCP连接问题,以避开可能的连接问题鞭打,路由等 一个使用常用的telnet命令来测试服务器的可用性:

You start walking up the OSI model to debug TCP connection problems to evade possible connection issues due to firewals, routing etc. One uses the commonly available telnet command to test the availability of the server:

telnet 192.168.22.17 8529
Trying 192.168.22.17...

如果它永远存在,那么您很可能有防火墙将您过滤掉了,您最终将获得:

If it sits there forever, you most probably have a firewall filtering you away, you finaly will get:

telnet: Unable to connect to remote host: Connection timed out

如果立即退出并显示:

telnet: Unable to connect to remote host: Connection refused

服务器似乎没有应答.

It seems the server doesn't answer.

然后在服务器端,您可以检查服务是否绑定了您要连接的端口(8529):

On the server side you then can check whether the service has bound the port (8529) you're trying to connect:

netstat -alpnt |grep 8529
tcp        0      0 0.0.0.0:8529            0.0.0.0:*               LISTEN      19912/arangod   

如果相反地看到它绑定了127.0.0.1:8529,您将无法远程连接它,需要像这样更改arangod.conf:

If you instead see it binding 127.0.0.1:8529 you won't be able to connect it remotely and need to change arangod.conf like this:

[server]
endpoint = tcp://0.0.0.0:8529

然后重新启动ArangoDB.然后,您应该可以看到如下内容:

And then restart ArangoDB. Then, you should be able to see something like this:

telnet 192.168.22.17 8529
Trying 192.168.22.17...
Connected to 192.168.22.17.
Escape character is '^]'. <start to type now: >
GET / HTTP/1.0

<server should reply:>
HTTP/1.1 301 Moved Permanently
Location: /_db/_system/_admin/aardvark/index.html
Content-Type: text/html
Server: ArangoDB
Connection: Close
Content-Length: 197

<html><head><title>Moved</title></head><body><h1>Moved</h1>
<p>This page has moved to <a href="/_db/_system/_admin/aardvark/index.html">/_db/_system/_admin/aardvark/index.html</a>.
</p></body></html>Connection closed by foreign host.

这篇关于通过Java接口远程访问ArangoDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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