Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Super Collaborator
ISSUE

While trying to connect to the HBase cluster from an edge node or a client HBase API we get the expection "Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations "

SYMPTOM

The exact stack that we encounter is as below:

log4j:WARN No appenders could be found for logger (org.apache.hadoop.util.Shell). 
log4j:WARN Please initialize the log4j system properly. 
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
SLF4J: Defaulting to no-operation (NOP) logger implementation 
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
Exception in thread "main" org.apache.hadoop.hbase.client.RetriesExhaustedException: Can't get the locations 
at org.apache.hadoop.hbase.client.RpcRetryingCallerWithReadReplicas.getRegionLocations(RpcRetryingCallerWithReadReplicas.java:312) 
at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:151) 
at org.apache.hadoop.hbase.client.ScannerCallableWithReplicas.call(ScannerCallableWithReplicas.java:59) 
at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithoutRetries(RpcRetryingCaller.java:200) 
at org.apache.hadoop.hbase.client.ClientScanner.call(ClientScanner.java:320) 
at org.apache.hadoop.hbase.client.ClientScanner.nextScanner(ClientScanner.java:295) 
at org.apache.hadoop.hbase.client.ClientScanner.initializeScannerInConstruction(ClientScanner.java:160) 
at org.apache.hadoop.hbase.client.ClientScanner.<init>(ClientScanner.java:155) 
at org.apache.hadoop.hbase.client.HTable.getScanner(HTable.java:821) 
at org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:193) 
at org.apache.hadoop.hbase.client.MetaScanner.metaScan(MetaScanner.java:89) 
at org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.isTableAvailable(ConnectionManager.java:991) 
at org.apache.hadoop.hbase.client.HBaseAdmin.isTableAvailable(HBaseAdmin.java:1400) 
at org.apache.hadoop.hbase.client.HBaseAdmin.isTableAvailable(HBaseAdmin.java:1408) 
at Table.main(Table.java:15) 

ROOT CAUSE

This happens when user has an incorrect value defined for "zookeeper.znode.parent" in the hbase-site.xml sourced on the client side or in case of a custom API written , the "zookeeper.znode.parent" was incorrectly updated to a wrong location . For example the default "zookeeper.znode.parent" is set to "/hbase-unsecure" , but if you incorrectly specify that as lets say "/hbase" as opposed to what we have set up in the cluster, we will encounter this exception while trying to connect to the HBase cluster.

RESOLUTION

The solution here would be to update the hbase-site.xml / source out the same hbase-site.xml from the cluster or update the HBase API to correctly point out the "zookeeper.znode.parent" value as updated in the HBase cluster.

20,123 Views
Comments

This is incorrect solution. If we have incorrect zookeeper.znode.parent = "/hbase" we will have exception like this: INFO ZooKeeper: Initiating client connection ... baseZNode=/hbase ...
ERROR ConnectionManager$HConnectionImplementation: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master.

Current issue not solve problem with: ... RetriesExhaustedException: Can't get the locations

I believe this could be because of deprecated APIs if the cluster is upgraded. It is recommended that org.apache.hadoop.hbase.client.Connection should be used to connect with Hbase tables.

Connection object encapsulates lower level individual connections to actual servers and a connection to zookeeper.

Connections are instantiated through the org.apache.hadoop.hbase.client.ConnectionFactory class.