Accessing HBase running in VM with a client on host system
Just to give an added value to users reading this, here is the solution:
Could not resolve the DNS name of cloudera-vm
To fix that I simply added to C:\Windows\System32\drivers\etc\hosts :
192.168.56.101 cloudera-vm
So whenever cloudera-vm is used it is resolved to the apropriate IP.The VM is now running at Host-Only-Network Mode, and is assigned to 192.168.56.101 now.So no port forwarding is necessary.
Just for comparison:
hbase-site.xml
<configuration> <property> <name>hbase.zookeeper.quorum</name> <value>cloudera-vm</value> </property></configuration>
persistence.xml
<persistence xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="hbase-addressbook" transaction-type="RESOURCE_LOCAL"> <properties> <property name="datanucleus.ConnectionURL" value="hbase:cloudera-vm" /> <property name="datanucleus.ConnectionUserName" value="" /> <property name="datanucleus.ConnectionPassword" value="" /> <property name="datanucleus.autoCreateSchema" value="true" /> <property name="datanucleus.validateTables" value="false" /> <property name="datanucleus.Optimistic" value="false" /> <property name="datanucleus.validateConstraints" value="false" /> </properties> </persistence-unit></persistence>
After that I got another error (connection refused although all connection strings were correct) thus I researched for days for the cause.
The solution was to disable IPV6 of Ubuntu running on the VM by appending the following to the file: /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1net.ipv6.conf.default.disable_ipv6 = 1net.ipv6.conf.lo.disable_ipv6 = 1
After reboot everything connects and works correctly :)
I think you can set the configuration clearly in the code ,like this HbaseConfiguration conf = HbaseConfiguration.create();conf.set("hbase.zookeeper.quorum", "ubuntu1,ubuntu2");...maybe help you ..
have you tried a simple:
<property name="connectionURL" value="hbase:master.standalone.hostname:60000"/>