Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

HBase java client failed to connect to multiple zookeeper quorums

Highlighted

HBase java client failed to connect to multiple zookeeper quorums

Explorer

Caused by: org.apache.hadoop.hbase.MasterNotRunningException: org.apache.hadoop.hbase.MasterNotRunningException: Can't get connection to ZooKeeper: KeeperErrorCode = ConnectionLoss for /hbase-secure

This is the error I get while attempting to run the following snippet

config.addResource(new Path(hbasePolicyPath));

config.addResource(new Path(hbaseSitepath));

connection = ConnectionFactory.createConnection(config);

admin = connection.getAdmin(); //hangs here for some minutes and then returns the above error.

Please note I'm attempting to connect to multiple zookeeper quorums.

4 REPLIES 4
Highlighted

Re: HBase java client failed to connect to multiple zookeeper quorums

Is your HBase cluster using the root znode of "/hbase-secure" in ZooKeeper? You can verify this from the HBase Master UI.

Can you please share a complete snippet and the HBase configuration file you include on the classpath (or in the `hdfsConfig` object)?

Highlighted

Re: HBase java client failed to connect to multiple zookeeper quorums

Explorer
String hbasePolicyPath = "hbase-policy.xml";
String hbaseSitepath ="hbase-site.xml";
config.set("hadoop.security.authentication", "kerberos");
UserGroupInformation.setConfiguration(config);
System.out.print("Enter principal");
System.out.println();
String principal = in.nextLine();  
//System.out.println("Attempting to authenticate with principal: : " + principal);
String keytab = "hbase.keytab";
if(principal != null && !principal.isEmpty() && keytab != null && !keytab.isEmpty()){
  logger.info("Login user " + principal + " from keytab " + keytab + " ....");
   UserGroupInformation userGroupInformation = UserGroupInformation.loginUserFromKeytabAndReturnUGI(pri   ncipal, keytab);
   UserGroupInformation.setLoginUser(userGroupInformation);
   logger.info("User logged in from keytab....");		
}
config.addResource(new Path(hbasePolicyPath));
config.addResource(new Path(hbaseSitepath));
connection = ConnectionFactory.createConnection(config);
System.out.println(connection.getConfiguration().get("hbase.zookeeper.quorum"));
logger.info("Connection Accepted");
admin = connection.getAdmin();
System.out.println(admin.getClusterStatus().getMaster());
System.out.println("Dead Server count:" + admin.getClusterStatus().getDeadServers());
			

yes the clusters are using the root znode of /habse-secure. I've also attached the hbase-site.xml

Highlighted

Re: HBase java client failed to connect to multiple zookeeper quorums

Super Collaborator

I checked zookeeper.znode.parent which shows

/hbase-secure

Are you able to browse master UI ?

If so, try using hbase shell next.

You may want to check the following line to make sure that path to hbase-site.xml is correct:

String hbaseSitepath ="hbase-site.xml";
Highlighted

Re: HBase java client failed to connect to multiple zookeeper quorums

Rising Star

It could be firewall issue for zookeeper quorums. Can you please check using ping command from your client machine like below

ping zookeeper quorums node

You have process firewall for all your zookeeper quorums nodes from client machine.

Don't have an account?
Coming from Hortonworks? Activate your account here