Hive scan fails with "Unable to retrieve HS2 host information from ZooKeeper"

Hive scans fail with Unable to retrieve HS2 host information from ZooKeeper when zookeeper_tls_enabled routes JDBC discovery to the secure ZooKeeper port; set the property to false in Cloudera Manager so Cloudera Migration Assistant uses the standard client port.

Symptom

Hive table scan fails with:

HiveScannerException: Connection to Hive using URL jdbc:hive2://<host>:2182/;...;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2 failed.
- Exception message: org.apache.hive.jdbc.ZooKeeperHiveClientException: Unable to retrieve HS2 host information from ZooKeeper

Cause

When zookeeper_tls_enabled is set to true in the ZooKeeper service configuration, Cloudera Migration Assistant connects to the secure ZooKeeper client port (default 2182) for HiveServer2 service discovery. The Hive JDBC driver does not pass the ZooKeeper TLS client parameters needed to negotiate TLS on that port, which results in a connection failure.

This failure commonly occurs on clusters where ZooKeeper has both zookeeper_tls_enabled set to true and zookeeper_client_portUnification set to true. With port unification enabled, the standard client port (2181) accepts both TLS and non-TLS connections, so using port 2182 is unnecessary.

Remedy

  1. In Cloudera Manager, go to the ZooKeeper service and open Configuration.
  2. Search for zookeeper_tls_enabled and set it to false.

    No service restart is required. Cloudera Migration Assistant reads this configuration dynamically when building the Hive JDBC connection URL.

  3. Retry the Hive scan.

    Cloudera Migration Assistant uses the standard ZooKeeper client port (2181) instead of the secure port (2182). When zookeeper_client_portUnification is enabled, port 2181 still accepts TLS connections from other services.

  4. Verify which ZooKeeper ports are configured:
    curl -su admin:admin "https://<cm-host>:7183/api/v58/clusters/<cluster>/services/ZOOKEEPER-1/config" | \
      python3 -c "import sys,json; d=json.load(sys.stdin); [print(i['name'],'=',i.get('value','')) for i in d['items'] if 'tls_enabled' in i['name'] or 'client_port' in i['name'] or 'portUnification' in i['name']]"