AnsweredAssumed Answered

Connecting to Hbase Tables from remote java application

Question asked by charanthota on Apr 5, 2016
Latest reply on Apr 6, 2016 by charanthota


Hi,

I am trying to connect to remote Hbase Cluster (Installed on Google Compute Engine) from my Java Application (Desktop),  after facing few issues I came to know that I need to install Mapr Client and I followed and installed the client using 

"server\configure.bat -N charan.paysafe.com -c -C 104.196.117.239:7222 -RM 104.196.54.255 -HS 104.196.48.236"

by following this doc Setting Up the Client - MapR 5.0 Documentation - doc.mapr.com

 

Also added core-site.xml

 

I also updated my /etc/hosts to look like below

104.196.117.239 master.c.mapr-training-1250.internal

104.196.50.109 node1.c.mapr-training-1250.internal

104.196.54.255 node2.c.mapr-training-1250.internal

104.196.48.236 node3.c.mapr-training-1250.internal

 

And here is my cluster setup info

 

Service Name Service Ports
CLDB

104.196.117.239:7222

Drill

104.196.117.239:31010

104.196.50.109:31010

104.196.54.255:31010

104.196.48.236:31010

HBase REST

104.196.117.239:8080

104.196.50.109:8080

104.196.54.255:8080

104.196.48.236:8080

HBase Thrift

104.196.48.236:9090

Hive Metastore

104.196.48.236:9083

Hive Server 2

104.196.48.236:10000

Hive WebHCat

104.196.48.236:50111

HTTPFS

104.196.48.236:14000

Hue

104.196.48.236:8002

YARN Node Manager

104.196.117.239:8041

104.196.50.109:8041

104.196.54.255:8041

104.196.48.236:8041

Oozie

104.196.48.236:11000

YARN Resource Manager

104.196.117.239:8032

104.196.50.109:8032

104.196.54.255:8032

Zookeeper

104.196.117.239:5181

104.196.50.109:5181

104.196.54.255:5181

When I am trying to connect to my cluster using the below java code.

 

public static final String HBASE_CONFIGURATION_ZOOKEEPER_QUORUM                     = "hbase.zookeeper.quorum";
public static final String HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT                 = "hbase.zookeeper.property.clientPort";
public static final String hbaseZookeeperQuorum = "104.196.117.239,104.196.50.109,104.196.54.255";
public static final int hbaseZookeeperClientPort=5181;

 

Configuration conf = HBaseConfiguration.create();

    conf.set(HBASE_CONFIGURATION_ZOOKEEPER_QUORUM, hbaseZookeeperQuorum);

    conf.setInt(HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT, hbaseZookeeperClientPort);

     Connection connection = ConnectionFactory.createConnection(conf);

        table = connection.getTable(TableName.valueOf(Bytes.toBytes(tableName)));

 

Now I am getting the following errors :

 

log4j:WARN No appenders could be found for logger (com.mapr.baseutils.cldbutils.CLDBRpcCommonUtils).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

2016-04-05 19:29:31,7891 Some error on socket 1704

2016-04-05 19:29:31,7891 ERROR Client fs/client/fileclient/cc/client.cc:5826 Thread: 11568 rpc err Cannot send after transport endpoint shutdown(108) 28.21 to 10.142.0.3:5660, fid 2049.16.2, upd 0

2016-04-05 19:29:53,7915 Some error on socket 1708

2016-04-05 19:30:16,7944 Some error on socket 1708

 

Could you please help me know what else I need to do , to make my app talk to my cluster?

I am able to run the code inside cluster, but not able to run from my desktop

Outcomes