Skip to main content
sibin
Bronze ⭐️⭐️⭐️
May 30, 2024
Question

Cloudera after setting up custom kerberos for hive: Unable to read HiveServer2 configs from ZooKeeper (state=,code=0)

After setting custom kerberos princ for hive: Unable to read HiveServer2 configs from ZooKeeper (state=,code=0). But if i use default kerb principal i am able to logon to hive.

followed this doc
https://docs.cloudera.com/cdp-private-cloud-base/7.1.9/security-kerberos-authentication/topics/hive-custom-kerberos-principal.html

 

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Connecting to jdbc:hive2://im19-vm4.eng.cohesity.com:2181,im19-vm5.eng.cohesity.com:2181,im19-vm6.eng.cohesity.com:2181/default;password=root;principal=khive/_HOST@im19-vm4.realm;serviceDiscoveryMode=zooKeeper;ssl=true;sslTrustStore=/var/lib/cloudera-scm-agent/agent-cert/cm-auto-global_truststore.jks;trustStorePassword=9xSdfOCgyzHPGv24yUYU9QOob4sKxiey5GsTnZgK7oB;trustStoreType=jks;user=root;zooKeeperNamespace=hiveserver2
Error: org.apache.hive.jdbc.ZooKeeperHiveClientException: Unable to read HiveServer2 configs from ZooKeeper (state=,code=0)
Beeline version 3.1.3000.7.1.9.0-387 by Apache Hive
beeline>

=====================================================================================
zookeeper checks
[zk: localhost:2181(CONNECTED) 2] ls /
[confstore, hbase, hiveserver2, rmstore, zookeeper]
[zk: localhost:2181(CONNECTED) 3] ls /hiveserver2
[]

 

 

2 replies

RAGHUY
Gold ⭐️
Gold ⭐️
May 30, 2024

@sibin 

Ensure that the /hiveserver2 znode exists and contains the necessary configurations. The fact that ls /hiveserver2 returns an empty list suggests that HiveServer2 has not correctly registered its configurations in ZooKeeper.

Look into the HiveServer2 logs for any errors or warnings related to ZooKeeper or Kerberos

Create Kerberos Principal
kadmin.local -q "addprinc -randkey khive/im19-vm4@IM19-V4.REALM"
Generate Keytab File
kadmin.local -q "xst -k /etc/security/keytabs/khive.keytab khive/im19-vm4@IM19-V4.REALM"
Verify Keytab File
klist -k /etc/security/keytabs/khive.keytab
Set Permissions
chown hive:hive /etc/security/keytabs/khive.keytab
chmod 400 /etc/security/keytabs/khive.keytab
Update hive-site.xml
<property>
<name>hive.server2.authentication.kerberos.principal</name>
<value>khive/im19-vm4@IM19-V4.REALM</value>
</property>
<property>
<name>hive.server2.authentication.kerberos.keytab</name>
<value>/etc/security/keytabs/khive.keytab</value>
</property>


Restart hiveserver2

 

Translate
DianaTorres
Community Manager
Community Manager
June 3, 2024

@sibin Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks.

Translate
Regards, Diana Torres, Senior Community Moderator