java调用远程接口,通过Java接口远程访问ArangoDB

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

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

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

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); }

Please help me in this regard.

Awaiting your response.

Thanks & Best Regards,

- Mahi

解决方案

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

If arangodb properties looks like that:

port=8529

host=192.168.22.17

user=root

password=OpenSesame

enableCURLLogger=false

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

If it immediately exits with:

telnet: Unable to connect to remote host: Connection refused

It seems the server doesn't answer.

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

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

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 '^]'.

GET / HTTP/1.0

HTTP/1.1 301 Moved Permanently

Location: /_db/_system/_admin/aardvark/index.html

Content-Type: text/html

Server: ArangoDB

Connection: Close

Content-Length: 197

Moved

Moved

This page has moved to /_db/_system/_admin/aardvark/index.html.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值