(kerberos)fix hive keberos principal usage
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user