Created 09-29-2023 07:14 AM
Hi,
in a Unix environment, I get this error while connecting to Hive via Kerberos, using the library pyHive in a python script:
thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-1) SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Server krbtgt/LOCAL.IT@EXAMPLE.IT not found in Kerberos database)'
I am able to connect to Kerberos using "kinit -kt user user.keytab", and also via Hive ODBC driver. I use the same krb5.conf file, with Default Realm = EXAMPLE.IT.
With kinit, I obtain, correctly:
Default principal: user@EXAMPLE.IT
Valid starting Expires Service principal
09/28/23 11:05:16 09/28/23 11:05:16 krbtgt/EXAMPLE.IT@EXAMPLE.IT
The error is only using pyHive library. In the error, the library uses the domain LOCAL.IT instead of the one specified in krb5.conf, that is EXAMPLE.IT
My connection in pyHive:
conn = hive.Connection(host="host.domain.it", port=10000, auth="KERBEROS", database="db_123", kerberos_service_name="hive")
Can you help me?
Thank you
Created 09-29-2023 10:27 AM
PyHive is not maintained by Cloudera, Can you use Impyla to connect to HiveServer2? It should work with HS2 also.
Created 10-02-2023 01:56 AM
Additionally, you can also choose to use PyODBC:
https://pypi.org/project/pyodbc/
together with the Cloudera Hive ODBC drivers:
https://cloudera.com/downloads/connectors/hive/odbc
This should give the best compatibility with Hive.
Best regards
Miklos
Created 10-02-2023 09:23 AM
Created 10-06-2023 04:40 PM
@andrea_pretotto 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.
Regards,
Diana Torres,