本文整理了Java中org.apache.hadoop.hive.shims.Utils.setTokenStr()
方法的一些代码示例,展示了Utils.setTokenStr()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.setTokenStr()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.shims.Utils
类名称:Utils
方法名:setTokenStr
[英]Create a delegation token object for the given token string and service. Add the token to given UGI
[中]为给定的令牌字符串和服务创建委派令牌对象。将令牌添加到给定的UGI
代码示例来源:origin: apache/drill
Utils.setTokenStr(ugiForRpc, delegationToken, HiveClientWithAuthzWithCaching.DRILL2HMS_TOKEN);
} catch (IOException e) {
throw new DrillRuntimeException("Couldn't setup delegation token in the UGI for Hive MetaStoreClient", e);
代码示例来源:origin: dremio/dremio-oss
/**
* Helper method that gets the delegation token using <i>processHiveClient</i> for given <i>proxyUserName</i>
* and sets it in proxy user UserGroupInformation and proxy user HiveConf.
*/
protected static void getAndSetDelegationToken(final HiveConf proxyUserHiveConf, final UserGroupInformation proxyUGI,
final HiveClient processHiveClient) {
checkNotNull(processHiveClient, "process user Hive client required");
checkNotNull(proxyUserHiveConf, "Proxy user HiveConf required");
checkNotNull(proxyUGI, "Proxy user UserGroupInformation required");
try {
final String delegationToken = processHiveClient.getDelegationToken(proxyUGI.getUserName());
Utils.setTokenStr(proxyUGI, delegationToken, "DremioDelegationTokenForHiveMetaStoreServer");
proxyUserHiveConf.set("hive.metastore.token.signature", "DremioDelegationTokenForHiveMetaStoreServer");
} catch (Exception e) {
final String processUsername = ImpersonationUtil.getProcessUserUGI().getShortUserName();
throw UserException.permissionError(e)
.message("Failed to generate Hive metastore delegation token for user %s. " +
"Check Hadoop services (including metastore) have correct proxy user impersonation settings (%s, %s) " +
"and services are restarted after applying those settings.",
proxyUGI.getUserName(),
String.format("hadoop.proxyuser.%s.hosts", processUsername),
String.format("hadoop.proxyuser.%s.groups", processUsername)
)
.addContext("Proxy user", proxyUGI.getUserName())
.build(logger);
}
}
代码示例来源:origin: org.apache.spark/spark-hive-thriftserver
/**
* Enable delegation token for the session
* save the token string and set the token.signature in hive conf. The metastore client uses
* this token.signature to determine where to use kerberos or delegation token
* @throws HiveException
* @throws IOException
*/
private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN);
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup delegation token in the ugi", e);
}
}
}
代码示例来源:origin: com.github.hyukjinkwon/hive-service
/**
* Enable delegation token for the session
* save the token string and set the token.signature in hive conf. The metastore client uses
* this token.signature to determine where to use kerberos or delegation token
* @throws HiveException
* @throws IOException
*/
private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN);
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup delegation token in the ugi", e);
}
}
}
代码示例来源:origin: org.apache.spark/spark-hive-thriftserver_2.11
/**
* Enable delegation token for the session
* save the token string and set the token.signature in hive conf. The metastore client uses
* this token.signature to determine where to use kerberos or delegation token
* @throws HiveException
* @throws IOException
*/
private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN);
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup delegation token in the ugi", e);
}
}
}
代码示例来源:origin: org.spark-project.hive/hive-service
/**
* Enable delegation token for the session
* save the token string and set the token.signature in hive conf. The metastore client uses
* this token.signature to determine where to use kerberos or delegation token
* @throws HiveException
* @throws IOException
*/
private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
Utils.setTokenStr(sessionUgi, delegationTokenStr, HS2TOKEN);
} catch (IOException e) {
throw new HiveSQLException("Couldn't setup delegation token in the ugi", e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!