Failed to remotely connect HBase from Java application

I have installed HBase on Linux Machine (192.168.113.27) and now I have written some sample code in Eclipse IDE on Windows Machine using JAVA API to communicate with HBase on Linux Machine. I have created a "users" table in HBase on a Linux Machine.

The client is connected to the zookeeper as indicated in the following logs: After that I get the "No Region found for users table" exception. To solve this problem, I read various threads and tried different things but could not solve it.

I tried to change localhost to Linux machine IP (192.168.113.27) in / conf / regionservers but still get the same error.

Sample code:

Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "192.168.113.27");
conf.set("hbase.zookeeper.property.clientPort","2181");

HTableInterface usersTable = new HTable(conf, "users");

      

Client side login:

13/02/06 10:58:32 INFO zookeeper.ClientCnxn: Session creation completed on server 192.168.113.27/192.168.113.27:2181, sessionid = 0x13cae4bd91b0003, negotiated timeout = 40000

This means that a connection to the zookeeper has been created.

Further, on the Excision screen, no regions were found for the Users table.

org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for users, 99999999999999 after 10 attempts. at org.apache.hadoop.hbase.client.HConnectionManager $ HConnectionImplementation.locateRegionInMeta (HConnectionManager.java:951) at org.apache.hadoop.hbase.client.HConnectionManager $ HConnectiongionplementation.HConnectionManager $ HConnectionImplementation.HConnectionManager $ HConnectionImplementation. .hadoop.hbase.client.HConnectionManager $ HConnectionImplementation.locateRegionInMeta (HConnectionManager.java:958) at org.apache.hadoop.hbase.client.HConnectionManager $ HConnection.Implementation.locateRegion (HConnectionImplementation.locateRegion) .client.HConnectionManager $ HConnectionImplementation.locateRegion (HConnectionManager.java:817) at org.apache.hadoop.hbase.client.HTable.finishSetup (HTable.java:234) at org.apache.hadoop.hbase.client.HTable. (HTable.java:174) at org.apache.hadoop.hbase.client.HTable. (HTable.java:133) at com.samsung.HBase.DBMain.putData (DBMain.java:32)

+3


source to share


2 answers


Yes, I had this problem too. It took a while to figure it out.

If you step into the HBase code of the HConnectionManager, you can see that this method is being called.

   HRegionInterface getHRegionConnection(final String hostname, final int port,

      

Make sure the value of the hostname argument maps to the VALID of the IP address.



For example, in my case, I had a local hbase server on my LAN with hostname "ubuntu", but the machine I tested the hbase client on did not have a valid mapping IP for hostname "ubuntu" on Windows 7 contains a.

adding this entry to my Windows 7 file fixes the problem

192.168.0.101   ubuntu

      

+2


source


I think I remember something like this. This is because Zookeper is returning a private IP if I remember correctly.

In the client side HBase configuration, you should allow the hbase.rootdir

IP address to be specified instead of the hostname.



<configurtion>
    <property>
         <name>hbase.rootdir</name>
         <value>hdfs://<IP address>:<port>/<HBase location>/</value>
    </property>
</configuration>

      

0


source







All Articles