That’s an interesting question that I faced. I have a cluster somewhere on a LAN behind a machine that I can ssh to, and I need to run hbase shell from my local machine on it, or I have an hbase client that I want to connect to that cluster.
In order for hbase to successfully communicate it needs to have access to two ports. The first is the master port, which defaults to 60000 and the second is the zookeeper port and that’s 2181. Using basic linux techniques, we can use ssh to map those ports to local ports like this:
ssh firstname.lastname@example.org -L 60000:hbasemaster:60000 -L 60020:hbasemaster:60020 -L 2181:hbasemaster:2181
The assumption here is that the hbasemaster machine is accessible from the remotemachine.com . Now what will happen is that your local hbase shell will contact the local zookeeper on port 60000 and ask for the configuration. This port is mapped to the foreign zookeeper, which will tell it to go to hbasemaster to connect. So your machine will attempt to resolve the ip of hbasemaster. Now the next step is to edit your /etc/hosts and add a line for hbasemaster’s ip address as 127.0.0.1 .
Try to connect with hbase shell and run the list command, and it should work.