use of org.apache.accumulo.core.client.ClientConfiguration in project hive by apache.
the class HiveAccumuloHelper method setInputFormatZooKeeperInstance.
/**
* Calls {@link AccumuloInputFormat#setZooKeeperInstance(JobConf, ClientConfiguration)},
* suppressing exceptions due to setting the configuration multiple times.
*/
public void setInputFormatZooKeeperInstance(JobConf conf, String instanceName, String zookeepers, boolean isSasl) throws IOException {
try {
ClientConfiguration clientConf = getClientConfiguration(zookeepers, instanceName, isSasl);
AccumuloInputFormat.setZooKeeperInstance(conf, clientConf);
} catch (IllegalStateException ise) {
// AccumuloInputFormat complains if you re-set an already set value. We just don't care.
log.debug("Ignoring exception setting ZooKeeper instance of " + instanceName + " at " + zookeepers, ise);
}
}
use of org.apache.accumulo.core.client.ClientConfiguration in project hive by apache.
the class AccumuloConnectionParameters method getInstance.
public Instance getInstance() {
String instanceName = getAccumuloInstanceName();
// Fail with a good message
if (null == instanceName) {
throw new IllegalArgumentException("Accumulo instance name must be provided in hiveconf using " + INSTANCE_NAME);
}
if (useMockInstance()) {
return new MockInstance(instanceName);
}
String zookeepers = getZooKeepers();
// Fail with a good message
if (null == zookeepers) {
throw new IllegalArgumentException("ZooKeeper quorum string must be provided in hiveconf using " + ZOOKEEPERS);
}
ClientConfiguration clientConf = ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zookeepers).withSasl(useSasl());
return new ZooKeeperInstance(clientConf);
}
use of org.apache.accumulo.core.client.ClientConfiguration in project YCSB by brianfrankcooper.
the class AccumuloClient method init.
@Override
public void init() throws DBException {
colFam = new Text(getProperties().getProperty("accumulo.columnFamily"));
colFamBytes = colFam.toString().getBytes(UTF_8);
inst = new ZooKeeperInstance(new ClientConfiguration().withInstance(getProperties().getProperty("accumulo.instanceName")).withZkHosts(getProperties().getProperty("accumulo.zooKeepers")));
try {
String principal = getProperties().getProperty("accumulo.username");
AuthenticationToken token = new PasswordToken(getProperties().getProperty("accumulo.password"));
connector = inst.getConnector(principal, token);
} catch (AccumuloException | AccumuloSecurityException e) {
throw new DBException(e);
}
if (!(getProperties().getProperty("accumulo.pcFlag", "none").equals("none"))) {
System.err.println("Sorry, the ZK based producer/consumer implementation has been removed. " + "Please see YCSB issue #416 for work on adding a general solution to coordinated work.");
}
}
use of org.apache.accumulo.core.client.ClientConfiguration in project vertexium by visallo.
the class AccumuloElementInputFormatBase method setInputInfo.
public static void setInputInfo(Job job, String instanceName, String zooKeepers, String principal, AuthenticationToken token, String[] authorizations, String tableName) throws AccumuloSecurityException {
AccumuloRowInputFormat.setInputTableName(job, tableName);
AccumuloRowInputFormat.setConnectorInfo(job, principal, token);
ClientConfiguration clientConfig = new ClientConfiguration().withInstance(instanceName).withZkHosts(zooKeepers);
AccumuloRowInputFormat.setZooKeeperInstance(job, clientConfig);
AccumuloRowInputFormat.setScanAuthorizations(job, new org.apache.accumulo.core.security.Authorizations(authorizations));
job.getConfiguration().setStrings(VertexiumMRUtils.CONFIG_AUTHORIZATIONS, authorizations);
}
Aggregations