The api HBaseAdmin has modified, So we should add some introduce:
If new a instance , it needs delete connection.
eg:
HBaseAdmin hba = new HBaseAdmin(conf);
.......
HConnectionManager.deleteConnection(hba.getConfiguration(), false);
public HBaseAdmin (Configuration c)
throws MasterNotRunningException, ZooKeeperConnectionException {
this.conf = HBaseConfiguration.create(c); // new
conf, so It will create a new connection
this.connection = HConnectionManager.getConnection(this.conf);
this.pause = this.conf.getLong("hbase.client.pause", 1000);
this.numRetries = this.conf.getInt("hbase.client.retries.number", 10);
this.retryLongerMultiplier =
this.conf.getInt("hbase.client.retries.longer.multiplier", 10);
this.connection.getMaster();
}
In my cluster.
New HBaseAdmin instance will create a new connection for zk.( we share
HBaseConfiguration for multithread, It is ok for 0.90.2)
But, In 0.90.3 throw exception:
checkHtableState happen an exception. begin reconnect. exception
info:org.apache.hadoop.hbase.ZooKeeperConnectionException: HBase is able to
connect to ZooKeeper but the connection closes immediately. This could be a
sign that the server has too many connections (30 is the default). Consider
inspecting your ZK server logs for that error and then make sure you are
reusing HBaseConfiguration as often as you can. See HTable's javadoc for more
information