本文整理了Java中org.apache.hadoop.hive.shims.Utils.setZookeeperClientKerberosJaasConfig()
方法的一些代码示例,展示了Utils.setZookeeperClientKerberosJaasConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.setZookeeperClientKerberosJaasConfig()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.shims.Utils
类名称:Utils
方法名:setZookeeperClientKerberosJaasConfig
[英]Dynamically sets up the JAAS configuration that uses kerberos
[中]动态设置使用kerberos的JAAS配置
代码示例来源:origin: apache/hive
/**
* For a kerberized cluster, we dynamically set up the client's JAAS conf.
*
* @param hiveConf
* @return
* @throws Exception
*/
private void setUpZooKeeperAuth(HiveConf hiveConf) throws Exception {
if (UserGroupInformation.isSecurityEnabled()) {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);
if (principal.isEmpty()) {
throw new IOException("HiveServer2 Kerberos principal is empty");
}
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB);
if (keyTabFile.isEmpty()) {
throw new IOException("HiveServer2 Kerberos keytab is empty");
}
// Install the JAAS Configuration for the runtime
Utils.setZookeeperClientKerberosJaasConfig(principal, keyTabFile);
}
}
代码示例来源:origin: com.github.hyukjinkwon/hive-service
/**
* For a kerberized cluster, we dynamically set up the client's JAAS conf.
*
* @param hiveConf
* @return
* @throws Exception
*/
private void setUpZooKeeperAuth(HiveConf hiveConf) throws Exception {
if (UserGroupInformation.isSecurityEnabled()) {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);
if (principal.isEmpty()) {
throw new IOException("HiveServer2 Kerberos principal is empty");
}
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB);
if (keyTabFile.isEmpty()) {
throw new IOException("HiveServer2 Kerberos keytab is empty");
}
// Install the JAAS Configuration for the runtime
Utils.setZookeeperClientKerberosJaasConfig(principal, keyTabFile);
}
}
代码示例来源:origin: org.apache.hive/hive-service
/**
* For a kerberized cluster, we dynamically set up the client's JAAS conf.
*
* @param hiveConf
* @return
* @throws Exception
*/
private void setUpZooKeeperAuth(HiveConf hiveConf) throws Exception {
if (UserGroupInformation.isSecurityEnabled()) {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);
if (principal.isEmpty()) {
throw new IOException("HiveServer2 Kerberos principal is empty");
}
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB);
if (keyTabFile.isEmpty()) {
throw new IOException("HiveServer2 Kerberos keytab is empty");
}
// Install the JAAS Configuration for the runtime
Utils.setZookeeperClientKerberosJaasConfig(principal, keyTabFile);
}
}
代码示例来源:origin: org.spark-project.hive/hive-service
/**
* For a kerberized cluster, we dynamically set up the client's JAAS conf.
*
* @param hiveConf
* @return
* @throws Exception
*/
private void setUpZooKeeperAuth(HiveConf hiveConf) throws Exception {
if (UserGroupInformation.isSecurityEnabled()) {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL);
if (principal.isEmpty()) {
throw new IOException("HiveServer2 Kerberos principal is empty");
}
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB);
if (keyTabFile.isEmpty()) {
throw new IOException("HiveServer2 Kerberos keytab is empty");
}
// Install the JAAS Configuration for the runtime
Utils.setZookeeperClientKerberosJaasConfig(principal, keyTabFile);
}
}
代码示例来源:origin: com.github.hyukjinkwon.shims/hive-shims-common
private void setupJAASConfig(Configuration conf) throws IOException {
if (!UserGroupInformation.getLoginUser().isFromKeytab()) {
// The process has not logged in using keytab
// this should be a test mode, can't use keytab to authenticate
// with zookeeper.
LOGGER.warn("Login is not from keytab");
return;
}
String principal;
String keytab;
switch (serverMode) {
case METASTORE:
principal = getNonEmptyConfVar(conf, "hive.metastore.kerberos.principal");
keytab = getNonEmptyConfVar(conf, "hive.metastore.kerberos.keytab.file");
break;
case HIVESERVER2:
principal = getNonEmptyConfVar(conf, "hive.server2.authentication.kerberos.principal");
keytab = getNonEmptyConfVar(conf, "hive.server2.authentication.kerberos.keytab");
break;
default:
throw new AssertionError("Unexpected server mode " + serverMode);
}
Utils.setZookeeperClientKerberosJaasConfig(principal, keytab);
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
private void setupJAASConfig(Configuration conf) throws IOException {
if (!UserGroupInformation.getLoginUser().isFromKeytab()) {
// The process has not logged in using keytab
// this should be a test mode, can't use keytab to authenticate
// with zookeeper.
LOGGER.warn("Login is not from keytab");
return;
}
String principal;
String keytab;
switch (serverMode) {
case METASTORE:
principal = getNonEmptyConfVar(conf, "hive.metastore.kerberos.principal");
keytab = getNonEmptyConfVar(conf, "hive.metastore.kerberos.keytab.file");
break;
case HIVESERVER2:
principal = getNonEmptyConfVar(conf, "hive.server2.authentication.kerberos.principal");
keytab = getNonEmptyConfVar(conf, "hive.server2.authentication.kerberos.keytab");
break;
default:
throw new AssertionError("Unexpected server mode " + serverMode);
}
Utils.setZookeeperClientKerberosJaasConfig(principal, keytab);
}
内容来源于网络,如有侵权,请联系作者删除!