>> - Under what conditions is the IOException catch actually reached? ConnectionFactory just instantiates and initiates connection implementation, I do not think it does anything beyond that (the only way to get cluster status is to connect to master, use HBaseAdmin instance, and wait until rpcTimeout expires if Master is not available) No magic of instant cluster status notification yet. You may try reducing rpcTimeout hbase.rpc.timeout from default 60000 and hbase.client.operation.timeout from 1200000 to some lower values :
Configuration conf = HBaseConfiguration.create(); conf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 2000); conf.setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, 2000); Connection conn = ConnectionFactory.createConnection(conf); To get a connection which fails faster than default one (20 min :)) -Vlad On Fri, Jul 17, 2015 at 6:36 AM, Dmitry Minkovsky <[email protected]> wrote: > I am using HBase 1.1.0 and create HBase client connections like this: > > try { > Configuration config = HBaseConfiguration.create(); > connection = ConnectionFactory.createConnection(config); > } > catch (IOException e) { > logger.info("Error {}", e); > } > > However, I noticed that when ZooKeeper and HBase Master/Region servers are > down, the catch clause is never reached. The code runs as if the connection > is made, and connection.isClosed() returns false. So: > > - What happens when I use this connection? Are the RPC calls buffered and > retried at some interval in background? > > - How can I tell whether the connection is actually ready for use? Should I > try to do this, or just use it? My inclination is not to run a client > service without the underlying datastores all actually ready, but perhaps > this is not the idea with the new HBase API. > > - Under what conditions is the IOException catch actually reached? > > > My goal is to be able to fail fast. Is that the wrong idea with this > client? > > > Thanks, > Dmitry >
