Examples of ZooKeeperInstance


Examples of org.apache.accumulo.core.client.ZooKeeperInstance

    folder.delete();
  }

  @Test
  public void test() throws Exception {
    ZooKeeperInstance inst = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers(), 60 * 1000);
    Connector conn = inst.getConnector("root", new PasswordToken(secret));

    String table = "foo";
    conn.tableOperations().create(table);

    final DefaultConfiguration defaultConf = AccumuloConfiguration.getDefaultConfiguration();

    // Cache invalidates 25% of the time
    int randomMax = 4;
    // Number of threads
    int numThreads = 2;
    // Number of iterations per thread
    int iterations = 100000;
    AccumuloConfiguration tableConf = new TableConfiguration(inst.getInstanceID(), inst, table, defaultConf);
   
    long start = System.currentTimeMillis();
    ExecutorService svc = Executors.newFixedThreadPool(numThreads);
    CountDownLatch countDown = new CountDownLatch(numThreads);
    ArrayList<Future<Exception>> futures = new ArrayList<Future<Exception>>(numThreads);
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

  public static TemporaryFolder folder = new TemporaryFolder();
  private MiniAccumuloCluster accumulo;
  private String secret = "secret";
 
  Connector getConnector() throws AccumuloException, AccumuloSecurityException {
    ZooKeeperInstance zki = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
    return zki.getConnector("root", new PasswordToken(secret));
  }
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

  private ChunkInputStream cis;
  Scanner scanner;
 
  public FileDataQuery(String instanceName, String zooKeepers, String user, AuthenticationToken token, String tableName, Authorizations auths) throws AccumuloException,
      AccumuloSecurityException, TableNotFoundException {
    ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
    conn = instance.getConnector(user, token);
    lastRefs = new ArrayList<Entry<Key,Value>>();
    cis = new ChunkInputStream();
    scanner = conn.createScanner(tableName, auths);
  }
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

  }

  @Test
  public void testOfflineTableWithoutCache() throws Exception {

    ZooKeeperInstance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector connector = instance.getConnector("root", password);

    BatchWriterConfig config = new BatchWriterConfig();

    TCredentials creds = CredentialHelper.create("root", password, instance.getInstanceID());
    MultiTableBatchWriter mtbw = new MultiTableBatchWriterImpl(instance, creds, config, 0, TimeUnit.SECONDS);
    boolean mutationsRejected = false;

    try {
      final String table1 = "testOfflineTableWithoutCache_table1", table2 = "testOfflineTableWithoutCache_table2";
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

public class MetadataBatchScanTest {
 
  public static void main(String[] args) throws Exception {
   
    final Connector connector = new ZooKeeperInstance("acu14", "localhost")
        .getConnector(SecurityConstants.SYSTEM_PRINCIPAL, SecurityConstants.getSystemToken());
   
    TreeSet<Long> splits = new TreeSet<Long>();
    Random r = new Random(42);
   
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

  public static Instance getInstance(Class<?> implementingClass, Configuration conf) {
    String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE), "");
    if ("MockInstance".equals(instanceType))
      return new MockInstance(conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME)));
    else if ("ZooKeeperInstance".equals(instanceType)) {
      return new ZooKeeperInstance(conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME)), conf.get(enumToConfKey(implementingClass,
          InstanceOpts.ZOO_KEEPERS)));
    } else if (instanceType.isEmpty())
      throw new IllegalStateException("Instance has not been configured for " + implementingClass.getSimpleName());
    else
      throw new IllegalStateException("Unrecognized instance type " + instanceType);
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

   
    if (null == zooKeepers) {
      return null;
    }
   
    return new ZooKeeperInstance(getInstanceName(), getZooKeepers());
  }
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

  }
 
  protected static Instance getInstance(Configuration conf) {
    if (conf.getBoolean(MOCK, false))
      return new MockInstance(conf.get(INSTANCE_NAME));
    return new ZooKeeperInstance(conf.get(INSTANCE_NAME), conf.get(ZOOKEEPERS));
  }
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

    String pass = args[3];
    String dataTable = args[4];
    ColumnVisibility colvis = new ColumnVisibility(args[5]);
    int chunkSize = Integer.parseInt(args[6]);

    Connector conn = new ZooKeeperInstance(instance, zooKeepers).getConnector(user, pass.getBytes());
    if (!conn.tableOperations().exists(dataTable)) {
      conn.tableOperations().create(dataTable);
      conn.tableOperations().attachIterator(dataTable, new IteratorSetting(1, ChunkCombiner.class));
    }
    BatchWriter bw = conn.createBatchWriter(dataTable, 50000000, 300000l, 4);
View Full Code Here

Examples of org.apache.accumulo.core.client.ZooKeeperInstance

 
  /**
   * @return The Accumulo instance.
   */
  protected static Instance getInstance(Configuration conf) {
    return new ZooKeeperInstance(conf.get(INSTANCE_NAME), conf.get(ZOOKEEPERS));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.