Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set time limit for creating HBase connection

Tags:

java

hbase

I'm currently using HBase v0.98.6. I would like to check the current connection status from an external Java program. Right now, I'm doing something like this to check:

connectionSuccess = true;
try {
     HConnection hConnection = createConnection(config);
} catch (Exception ex) {
     connectionSuccess = false;
}

When the connection is working, this returns fairly quickly. The problem is when the connection is not working, and it takes 20 minutes for it to finally return connectionSuccess=false. Is there a way to reduce this time limit, as I'm just interested in getting the connection status at the current time?

like image 423
shimizu Avatar asked Dec 30 '25 22:12

shimizu


1 Answers

The reason it takes so long is that by default if the connection fails it will retry multiple times (I think 6? don't quote me), and each connection attempt takes a while. Try a combination of these commands to limit time per connection before timeout, and number of permitted retry attempts.

hbase.client.retries.number = 3
hbase.client.pause = 1000
zookeeper.recovery.retry = 1 (i.e. no retry)

Credit to Lars from http://hadoop-hbase.blogspot.com/2012/09/hbase-client-timeouts.html

like image 85
Daniel Epstein Avatar answered Jan 01 '26 11:01

Daniel Epstein