You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2018/09/25 19:20:09 UTC
[GitHub] mikewalch commented on a change in pull request #35: Updates due to
Accumulo 2.0 changes
mikewalch commented on a change in pull request #35: Updates due to Accumulo 2.0 changes
URL: https://github.com/apache/accumulo-testing/pull/35#discussion_r220322107
##########
File path: core/src/main/java/org/apache/accumulo/testing/core/randomwalk/multitable/CopyTool.java
##########
@@ -64,70 +56,21 @@ public int run(String[] args) throws Exception {
return 1;
}
- ClientConfiguration clientConf = ClientConfiguration.create().withInstance(args[3]).withZkHosts(args[4]);
-
+ ClientInfo info = Accumulo.newClient().usingProperties(args[0]).info();
job.setInputFormatClass(AccumuloInputFormat.class);
- AccumuloInputFormat.setInputTableName(job, args[2]);
+ AccumuloInputFormat.setClientInfo(job, info);
+ AccumuloInputFormat.setInputTableName(job, args[1]);
AccumuloInputFormat.setScanAuthorizations(job, Authorizations.EMPTY);
- AccumuloInputFormat.setZooKeeperInstance(job, clientConf);
-
- final String principal;
- final AuthenticationToken token;
- if (Boolean.parseBoolean(clientConf.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED))) {
- // Use the Kerberos creds to request a DelegationToken for MapReduce
- // to use
- // We could use the specified keytab (args[1]), but we're already
- // logged in and don't need to, so we can just use the current user
- KerberosToken kt = new KerberosToken();
- try {
- UserGroupInformation user = UserGroupInformation.getCurrentUser();
- if (!user.hasKerberosCredentials()) {
- throw new IllegalStateException("Expected current user to have Kerberos credentials");
- }
-
- // Get the principal via UGI
- principal = user.getUserName();
-
- // Connector w/ the Kerberos creds
- ZooKeeperInstance inst = new ZooKeeperInstance(clientConf);
- Connector conn = inst.getConnector(principal, kt);
-
- // Do the explicit check to see if the user has the permission
- // to get a delegation token
- if (!conn.securityOperations().hasSystemPermission(conn.whoami(), SystemPermission.OBTAIN_DELEGATION_TOKEN)) {
- log.error(principal + " doesn't have the " + SystemPermission.OBTAIN_DELEGATION_TOKEN.name()
- + " SystemPermission neccesary to obtain a delegation token. MapReduce tasks cannot automatically use the client's"
- + " credentials on remote servers. Delegation tokens provide a means to run MapReduce without distributing the user's credentials.");
- throw new IllegalStateException(conn.whoami() + " does not have permission to obtain a delegation token");
- }
-
- // Fetch a delegation token from Accumulo
- token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig());
Review comment:
The delegation token should be created outside of this code and set in the client properties that are passed into the MapReduce code.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services