Docker - oracle.kv.FaultException: Could not contact any RepNode

醉酒当歌 提交于 2019-12-25 08:53:30

问题


I am new to Docker and nosql, I created a Oracle Linux VM (ipAddr 192.168.10.2) on my windows machine.

Further I created docker container (on this VM ) for kvlite and run my nosql-container as below:

$ docker run --name nosql-container -p 5000:5000 -d kvlite:latest

followed by below commands:

$ docker exec -it nosql-container bash

# java -jar lib/kvcli.jar -host localhost -port 5000

kv-> connect store -host localhost -port 5000 -name kvstore ;

This works fine till here and I believe my Docker container for kvlite is up and running fine.

Now I need to create a Client Java program from my windows machine to access this kvlite (running in docker container on a VM) To accomplish I downloaded kvclient.jar file and put that in my classpath.

The Java code-snippet below:

KVStore store = KVStoreFactory.getStore(new KVStoreConfig("kvstore", "192.168.10.2:5000"));

This throws an exception:

oracle.kv.FaultException: Could not contact any RepNode at: [192.168.10.2:5000] (12.1.4.0.9)

....

Caused by: java.rmi.UnknownHostException: Unknown host: ecfe59938ea4; nested exception is:

Any help appreciated in advance.


回答1:


I resolved the issue by adding a param --net=host when running nosql-container

$ docker run --name nosql-container --net=host -p 5000:5000 -d kvlite:latest

Now instead of IPAddress you can use VM hostname in Java Client code to access kvlite DB.

KVStore store = KVStoreFactory.getStore(new KVStoreConfig("kvstore", "VMHostname:5000"));


来源:https://stackoverflow.com/questions/40154567/docker-oracle-kv-faultexception-could-not-contact-any-repnode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!