0
votes

I have installed Hadoop and Hbase on a VirtualBox VM running Ubuntu; both Hadoop and Hbase are running successfully in pseudo-distributed mode. I have disabled IPv6 on Ubuntu and changed the localhost to 127.0.0.1 in the hosts file on the VM.

I am trying to write some basic Java code on a Windows machine in Eclipse to connect to the Hbase instance, create a table, insert and retrieve data, etc. The code fails with an error that it cannot connect to the master. However, it makes the Zookeeper connection to the VM just fine.

On the Windows machine, I am able to connect to the Hbase instance info via the web browser via the same IP address and port that I specify in the Java code.

I have searched everywhere and tried everything that I could find, but it is still failing to connect to the master after it makes the zookeeper connection.

I have read that others have had this problem too, but no one has posted a solution.

Please help! Thanks!

2
Could you please show me the error log?Tariq
Can you ping to VM from your host machine?Kowser
Hi -- Yes, I am able to ping the VM from the host machine. I am away from my machine now, so I will post the error logs when I return.willi7

2 Answers

0
votes

The IP and Port used to view information are not the one used to read/write from/into HBase. To do so you need to use either the REST API (included in HBase) or Apache Thrift (2 thrift servers are included in HBase - thrift & thrift2)

I would recommend you to use Apache Thrift (thrift2)

To start REST use :

$HBASE-INSTALL-DIR/bin/hbase-deamon.sh start rest

To start Thrift use :

$HBASE-INSTALL-DIR/bin/hbase-deamon.sh start thrift

To start Thrift (v2) use :

$HBASE-INSTALL-DIR/bin/hbase-deamon.sh start thrift2

To use the Thrift client from Java for example you will need to install thrift on the server and then generate the Java Classes using the hbase thrift file included with HBase.

By default Thrift will be listening on the 9090 port and REST on the 8080

Usefull Links :

HBase Thrift

HBase REST

0
votes

Ok -- Someone gave me some 1-1 help that fixed the problem and I wanted to pass it along. It turned out to be an IP addressing issue with the VM and with my Windows machine. First, in the etc/hosts file on the VM, I had to take out '127.0.0.1 locahost' and instead insert ' localhost'. Second, on my Windows hosts file, I had to add ' '. Thankfully, that fixed the problem. Please let me know this is unclear since I have seen this problem posted quite a few times without suitable resolution. Also, since I am writing Java code to access the HBase instance in the VM, there was no need to use Thrift or REST -- the Java API was sufficient.