ZooKeeper hbaseid error


What's inside this article ⌄
  • KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
  • ZooKeeper connection loss hbaseid

NOTE: If you’re trying to install Apache Atlas and receiving this error, there is a separate article.

Suppose that we are faced with these exceptions. The first:

[ReadOnlyZKClient-localhost:2181@<id>] [WARN] ReadOnlyZKClient$ZKTask$1:183 - <id> to localhost:2181 failed for get of /hbase/hbaseid, code = CONNECTIONLOSS, retries = 1
[ReadOnlyZKClient-localhost:2181@<id>] [WARN] ReadOnlyZKClient$ZKTask$1:183 - <id> to localhost:2181 failed for get of /hbase/meta-region-server, code = CONNECTIONLOSS, retries = 1

The second:

Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:102)
        at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
        at org.apache.hadoop.hbase.zookeeper.ReadOnlyZKClient$ZKTask$1.exec(ReadOnlyZKClient.java:189)
        at org.apache.hadoop.hbase.zookeeper.ReadOnlyZKClient.run(ReadOnlyZKClient.java:323)

The third:

ConnectionImplementation:529 - Retrieve cluster id failed
java.util.concurrent.ExecutionException: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
        at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
        at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
        at org.apache.hadoop.hbase.client.ConnectionImplementation.retrieveClusterId(ConnectionImplementation.java:527)
        at org.apache.hadoop.hbase.client.ConnectionImplementation.<init>(ConnectionImplementation.java:287)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:219)
        at org.apache.hadoop.hbase.client.ConnectionFactory.createConnection(ConnectionFactory.java:114)

The hbase-client cannot connect to the Zookeeper. We need to pay attention to the address:

... to localhost:2181 failed for get of ...

If there is a real Zookeeper instance at this address, then you need to check its state. But if there is no ZooKeeper instance at the given address, then the problem is in the under-configured hbase-site.xml configuration. If you have a Cloudera distribution, then it is located here:

/etc/hbase/conf.cloudera.hbase/hbase-site.xml

Check the following properties:

hbase.zookeeper.quorum
hbase.cluster.distributed
hbase.rootdir

In my case, the hbase.zookeeper.quorum field was not populated. Therefore, the hbase-client tried to connect to ZooKeeper using the standard host (localhost) and the standard port (2181).

If the file is empty or not exist at all – refer to the official documentation: https://hbase.apache.org/book.html.