Public Configuration getConf (int platform) throws IOException {
If (platform==1 | | platform==3) {
Return initConfiguration (A_CLUSTER_CONFIG_PATH);
} else {
Return initConfiguration (B_CLUSTER_CONFIG_PATH);
}
}
Private Configuration initConfiguration (String clusterConfigPath) {
System. SetProperty (" Java. Security. Krb5. Conf ", clusterConfigPath + "krb5.conf");
The conf=new Configuration ();
The conf. Set (" hadoop. Security. Authentication ", "Kerberos");
The conf. AddResource (new Path (clusterConfigPath + "core - site. XML"));
The conf. AddResource (new Path (clusterConfigPath + "HDFS - site. XML"));
The conf. Set (fs. HDFS. "impl", DistributedFileSystem. Class. The getName ());
The conf. SetBoolean (fs. HDFS. Impl. Disable. "cache", true);
KerberosAuthentication (conf, clusterConfigPath + "hiveConfig. The properties," clusterConfigPath + "bd_user. Keytab");
Return the conf.
}
Private void kerberosAuthentication (Configuration conf, String propPath, String keytabPath) {
Try {
UserGroupInformation. SetConfiguration (conf);
PropertiesUtil. LoadFromFileSystem (propPath);
UserGroupInformation. LoginUserFromKeytab (PropertiesUtil. Get string (hadoop. Kerberos. "principal"), keytabPath);
} the catch (IOException e) {
LogBetter. The instance (LOGGER). SetLevel (LogLevel. ERROR). SetMsg (" [ClusterConnectionManager] : Hadoop authentication failed "). The setException (e). The log ();
}
}
But the truth is only connected to a cluster, another cluster has been authentication failure
CodePudding user response:
Cluster (connect), a cluster b (not connected)Run the code host C, C/etc/krb5. Conf default_realm and code used in A krb5. Conf, unlike B?
CodePudding user response:
Bosses, solved?