(kerberos)fix hive keberos principal usage

This commit is contained in:
slothever
2024-03-21 15:34:57 +08:00
committed by yiguolei
parent 4e653b0baa
commit b727fd6594
2 changed files with 5 additions and 10 deletions

View File

@ -142,8 +142,8 @@ public class HMSExternalCatalog extends ExternalCatalog {
hiveConf.set(HiveConf.ConfVars.METASTORE_CLIENT_SOCKET_TIMEOUT.name(),
String.valueOf(Config.hive_metastore_client_timeout_second));
HadoopUGI.tryKrbLogin(this.getName(), AuthenticationConfig.getKerberosConfig(hiveConf,
AuthenticationConfig.HIVE_KERBEROS_PRINCIPAL,
AuthenticationConfig.HIVE_KERBEROS_KEYTAB));
AuthenticationConfig.HADOOP_KERBEROS_PRINCIPAL,
AuthenticationConfig.HADOOP_KERBEROS_KEYTAB));
}
metadataOps = ExternalMetadataOperations.newHiveMetadataOps(hiveConf, jdbcClientConfig, this);
}

View File

@ -817,15 +817,10 @@ public class HiveMetaStoreClientHelper {
}
public static <T> T ugiDoAs(Configuration conf, PrivilegedExceptionAction<T> action) {
// if hive config is not ready, then use hadoop kerberos to login
AuthenticationConfig krbConfig = AuthenticationConfig.getKerberosConfig(conf,
AuthenticationConfig.HIVE_KERBEROS_PRINCIPAL,
AuthenticationConfig.HIVE_KERBEROS_KEYTAB);
if (!krbConfig.isValid()) {
// if hive config is not ready, then use hadoop kerberos to login
krbConfig = AuthenticationConfig.getKerberosConfig(conf,
AuthenticationConfig.HADOOP_KERBEROS_PRINCIPAL,
AuthenticationConfig.HADOOP_KERBEROS_KEYTAB);
}
AuthenticationConfig.HADOOP_KERBEROS_PRINCIPAL,
AuthenticationConfig.HADOOP_KERBEROS_KEYTAB);
return HadoopUGI.ugiDoAs(krbConfig, action);
}