public class HiveAccumuloHelper extends Object
Modifier and Type | Field and Description |
---|---|
static org.apache.hadoop.io.Text |
ACCUMULO_SERVICE |
Constructor and Description |
---|
HiveAccumuloHelper() |
Modifier and Type | Method and Description |
---|---|
void |
addTokenFromUserToJobConf(org.apache.hadoop.security.UserGroupInformation user,
org.apache.hadoop.mapred.JobConf jobConf)
Extract the appropriate Token for Accumulo from the provided
user and add it to the
JobConf 's credentials. |
Object |
getClientConfiguration(String zookeepers,
String instanceName,
boolean useSasl)
Construct a
ClientConfiguration instance in a backwards-compatible way. |
org.apache.accumulo.core.client.security.tokens.AuthenticationToken |
getDelegationToken(org.apache.accumulo.core.client.Connector conn)
Obtain a DelegationToken from Accumulo in a backwards compatible manner.
|
org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> |
getHadoopToken(org.apache.accumulo.core.client.security.tokens.AuthenticationToken delegationToken) |
void |
mergeTokenIntoJobConf(org.apache.hadoop.mapred.JobConf jobConf,
org.apache.hadoop.security.token.Token<?> accumuloToken)
Merge the provided
Token into the JobConf. |
void |
setZooKeeperInstance(org.apache.hadoop.mapred.JobConf jobConf,
Class<?> inputOrOutputFormatClass,
String zookeepers,
String instanceName,
boolean useSasl)
Wrapper around
setZooKeeperInstance(Configuration, ClientConfiguration) which only
exists in 1.6.0 and newer. |
org.apache.accumulo.core.client.security.tokens.AuthenticationToken |
unwrapAuthenticationToken(org.apache.hadoop.mapred.JobConf jobConf,
org.apache.accumulo.core.client.security.tokens.AuthenticationToken token)
Wrapper around
ConfiguratorBase.unwrapAuthenticationToken which only exists in
1.7.0 and new. |
public void addTokenFromUserToJobConf(org.apache.hadoop.security.UserGroupInformation user, org.apache.hadoop.mapred.JobConf jobConf) throws IOException
user
and add it to the
JobConf
's credentials.user
- User containing tokensjobConf
- The configuration for the jobIOException
- If the correct token is not found or the Token fails to be merged with the
configurationpublic void mergeTokenIntoJobConf(org.apache.hadoop.mapred.JobConf jobConf, org.apache.hadoop.security.token.Token<?> accumuloToken) throws IOException
Token
into the JobConf.jobConf
- JobConf to merge token intoaccumuloToken
- The TokenIOException
- If the merging failspublic org.apache.accumulo.core.client.security.tokens.AuthenticationToken getDelegationToken(org.apache.accumulo.core.client.Connector conn) throws IOException
conn
- The Accumulo connectorIOException
- If the token cannot be obtainedpublic org.apache.hadoop.security.token.Token<? extends org.apache.hadoop.security.token.TokenIdentifier> getHadoopToken(org.apache.accumulo.core.client.security.tokens.AuthenticationToken delegationToken) throws IOException
IOException
public Object getClientConfiguration(String zookeepers, String instanceName, boolean useSasl) throws IOException
ClientConfiguration
instance in a backwards-compatible way. Allows us
to support Accumulo 1.5zookeepers
- ZooKeeper hostsinstanceName
- Instance nameuseSasl
- Is SASL enabledIOException
- If the instance fails to be createdpublic void setZooKeeperInstance(org.apache.hadoop.mapred.JobConf jobConf, Class<?> inputOrOutputFormatClass, String zookeepers, String instanceName, boolean useSasl) throws IOException
setZooKeeperInstance(Configuration, ClientConfiguration)
which only
exists in 1.6.0 and newer. Support backwards compat.jobConf
- The JobConfinputOrOutputFormatClass
- The InputFormat or OutputFormat classzookeepers
- ZooKeeper hostsinstanceName
- Accumulo instance nameuseSasl
- Is SASL enabledIOException
- When invocation of the method failspublic org.apache.accumulo.core.client.security.tokens.AuthenticationToken unwrapAuthenticationToken(org.apache.hadoop.mapred.JobConf jobConf, org.apache.accumulo.core.client.security.tokens.AuthenticationToken token) throws IOException
ConfiguratorBase.unwrapAuthenticationToken
which only exists in
1.7.0 and new. Uses reflection to not break compat.jobConf
- JobConf objecttoken
- The DelegationTokenStub instanceIOException
- If the token fails to be unwrappedCopyright © 2017 The Apache Software Foundation. All rights reserved.