@Override public Connector get() { try { Instance inst = new ZooKeeperInstance(instance, zooKeepers); Connector connector = inst.getConnector(username, new PasswordToken(password.getBytes(UTF_8))); LOG.info("Connection to instance %s at %s established, user %s", instance, zooKeepers, username); return connector; } catch (AccumuloException | AccumuloSecurityException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to get connector to Accumulo", e); } } }
@Override public void init() throws DBException { colFam = new Text(getProperties().getProperty("accumulo.columnFamily")); colFamBytes = colFam.toString().getBytes(UTF_8); inst = new ZooKeeperInstance( getProperties().getProperty("accumulo.instanceName"), 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."); } }
@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."); } }
@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."); } }
/** * Gets the AccumuloConnector singleton, starting the MiniAccumuloCluster on initialization. * This singleton instance is required so all test cases access the same MiniAccumuloCluster. * * @return Accumulo connector */ public static Connector getAccumuloConnector() { if (connector != null) { return connector; } try { MiniAccumuloCluster accumulo = createMiniAccumuloCluster(); Instance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()); connector = instance.getConnector(MAC_USER, new PasswordToken(MAC_PASSWORD)); LOG.info("Connection to MAC instance %s at %s established, user %s password %s", accumulo.getInstanceName(), accumulo.getZooKeepers(), MAC_USER, MAC_PASSWORD); return connector; } catch (AccumuloException | AccumuloSecurityException | InterruptedException | IOException e) { throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Failed to get connector to Accumulo", e); } }
/** * Initializes an Accumulo Instance based on the configuration. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key * @param conf * the Hadoop configuration object to configure * @return an Accumulo instance * @since 1.6.0 */ public static org.apache.accumulo.core.client.Instance getInstance(Class<?> implementingClass, Configuration conf) { String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE), ""); if ("ZooKeeperInstance".equals(instanceType)) { return new org.apache.accumulo.core.client.ZooKeeperInstance( getClientConfiguration(implementingClass, conf)); } else if (instanceType.isEmpty()) throw new IllegalStateException( "Instance has not been configured for " + implementingClass.getSimpleName()); else throw new IllegalStateException("Unrecognized instance type " + instanceType); }
public org.apache.accumulo.core.client.Instance getInstance( org.apache.accumulo.core.client.ClientConfiguration base) { if (null == instanceName) { return null; } if (null == zooKeepers) { return null; } return new org.apache.accumulo.core.client.ZooKeeperInstance( base.withInstance(getInstanceName()).withZkHosts(getZooKeepers())); }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = new MockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(this.instance, this.zookeepers); } }
synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); return cachedInstance = new ZooKeeperInstance(this.getClientConfiguration()); }
@Override public Connector getConnector(String user, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException { Instance instance = new ZooKeeperInstance(getClientConfig()); return instance.getConnector(user, token); }
@Override public Instance getInstance() { if (mock) return new MockInstance(instance); if (instance == null) { return HdfsZooInstance.getInstance(); } return new ZooKeeperInstance(this.instance, this.zookeepers); } }
public AccumuloConnectionFactory(AccumuloManagedConnectionFactory mcf) { this.mcf = mcf; this.instance = new ZooKeeperInstance(mcf.getInstanceName(), mcf.getZooKeeperServerList()); } @Override
@Override public Instance getInstance() { if (mock) return DeprecationUtil.makeMockInstance(instance); if (instance == null) { return HdfsZooInstance.getInstance(); } return new ZooKeeperInstance(this.getClientConfiguration()); } }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(getClientConfiguration()); } }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(this.getClientConfiguration()); }
public Connector createConnector() throws AccumuloSecurityException, AccumuloException { LOGGER.info("Connecting to accumulo instance [{}] zookeeper servers [{}]", this.getAccumuloInstanceName(), this.getZookeeperServers()); ZooKeeperInstance instance = new ZooKeeperInstance(this.getAccumuloInstanceName(), this.getZookeeperServers()); return instance.getConnector(this.getAccumuloUsername(), this.getAuthenticationToken()); }
public Instance getInstance(ClientConfiguration base) { if (null == instanceName) { return null; } if (isMockInstance()) { return DeprecationUtil.makeMockInstance(getInstanceName()); } if (null == zooKeepers) { return null; } return new ZooKeeperInstance(base.withInstance(getInstanceName()).withZkHosts(getZooKeepers())); }
/** * Creates Accumulo instance given FluoConfiguration */ public static Instance getInstance(FluoConfiguration config) { ClientConfiguration clientConfig = new ClientConfiguration() .withInstance(config.getAccumuloInstance()).withZkHosts(config.getAccumuloZookeepers()) .withZkTimeout(config.getZookeeperTimeout() / 1000); return new ZooKeeperInstance(clientConfig); }
/** * Creates Accumulo instance given FluoConfiguration */ public static Instance getInstance(FluoConfiguration config) { ClientConfiguration clientConfig = new ClientConfiguration().withInstance(config.getAccumuloInstance()) .withZkHosts(config.getAccumuloZookeepers()) .withZkTimeout(config.getZookeeperTimeout() / 1000); return new ZooKeeperInstance(clientConfig); }
public OsmProvider(final OSMIngestCommandArgs args, final AccumuloRequiredOptions store) throws AccumuloSecurityException, AccumuloException, TableNotFoundException { conn = new ZooKeeperInstance(store.getInstance(), store.getZookeeper()).getConnector( store.getUser(), new PasswordToken(store.getPassword())); bs = conn.createBatchScanner( args.getQualifiedTableName(), new Authorizations(args.getVisibilityOptions().getVisibility()), 1); }