protected void setAccumuloConnectorInfo(JobConf conf, String username, AuthenticationToken token) throws AccumuloSecurityException { try { AccumuloOutputFormat.setConnectorInfo(conf, username, token); } catch (IllegalStateException e) { // AccumuloOutputFormat complains if you re-set an already set value. We just don't care. log.debug("Ignoring exception setting Accumulo Connector instance for user " + username, e); } }
/** * Calls {@link AccumuloOutputFormat#setConnectorInfo(JobConf, String, AuthenticationToken)} * suppressing exceptions due to setting the configuration multiple times. */ public void setOutputFormatConnectorInfo(JobConf conf, String username, AuthenticationToken token) throws AccumuloSecurityException { try { AccumuloOutputFormat.setConnectorInfo(conf, username, token); } catch (IllegalStateException e) { // AccumuloOutputFormat complains if you re-set an already set value. We just don't care. log.debug("Ignoring exception setting Accumulo Connector instance for user " + username, e); } }
AccumuloOutputFormat.setBatchWriterOptions(job, batchConfig); AccumuloOutputFormat.setZooKeeperInstance(job, cluster.getClientConfig()); AccumuloOutputFormat.setConnectorInfo(job, "root", new PasswordToken(ROOT_PASSWORD)); RecordWriter<Text,Mutation> writer = outputFormat.getRecordWriter(null, job, "Test", null);
@Override public int run(String[] args) throws Exception { if (args.length != 3) { throw new IllegalArgumentException("Usage : " + MRTokenFileTester.class.getName() + " <token file> <inputtable> <outputtable>"); } String user = getAdminPrincipal(); String tokenFile = args[0]; String table1 = args[1]; String table2 = args[2]; JobConf job = new JobConf(getConf()); job.setJarByClass(this.getClass()); job.setInputFormat(AccumuloInputFormat.class); AccumuloInputFormat.setConnectorInfo(job, user, tokenFile); AccumuloInputFormat.setInputTableName(job, table1); AccumuloInputFormat.setZooKeeperInstance(job, getCluster().getClientConfig()); job.setMapperClass(TestMapper.class); job.setMapOutputKeyClass(Key.class); job.setMapOutputValueClass(Value.class); job.setOutputFormat(AccumuloOutputFormat.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Mutation.class); AccumuloOutputFormat.setConnectorInfo(job, user, tokenFile); AccumuloOutputFormat.setCreateTables(job, false); AccumuloOutputFormat.setDefaultTableName(job, table2); AccumuloOutputFormat.setZooKeeperInstance(job, getCluster().getClientConfig()); job.setNumReduceTasks(0); return JobClient.runJob(job).isSuccessful() ? 0 : 1; }
job.setOutputValueClass(Mutation.class); AccumuloOutputFormat.setConnectorInfo(job, user, new PasswordToken(pass)); AccumuloOutputFormat.setCreateTables(job, false); AccumuloOutputFormat.setDefaultTableName(job, table2);