Package org.apache.accumulo.core.client

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


    accumulo.start();
  }
 
  @Test(timeout = 30000)
  public void test() throws Exception {
    Connector conn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("root", "superSecret".getBytes());
   
    conn.tableOperations().create("table1");
   
    conn.securityOperations().createUser("user1", "pass1".getBytes(), new Authorizations("A", "B"));
    conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.WRITE);
    conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.READ);
   
    IteratorSetting is = new IteratorSetting(10, SummingCombiner.class);
    SummingCombiner.setEncodingType(is, LongCombiner.Type.STRING);
    SummingCombiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("META", "COUNT")));
   
    conn.tableOperations().attachIterator("table1", is);
   
    Connector uconn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("user1", "pass1".getBytes());
   
    BatchWriter bw = uconn.createBatchWriter("table1", 10000, 1000000, 2);
   
    UUID uuid = UUID.randomUUID();
   
View Full Code Here


  }
 
  @Test(timeout = 20000)
  public void testMultipleTabletServersRunning() throws AccumuloException, AccumuloSecurityException {
   
    Connector conn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("root", "superSecret".getBytes());
   
    while (conn.instanceOperations().getTabletServers().size() != 2) {
      UtilWaitThread.sleep(500);
    }
  }
View Full Code Here

   
    Random r = new Random();
    RandomAuths randomAuths = new RandomAuths(authsFile);
    Authorizations auths = randomAuths.getAuths(r);

    Connector conn = new ZooKeeperInstance(instanceName, zooKeepers).getConnector(user, password.getBytes());
    Scanner scanner = ContinuousUtil.createScanner(conn, table, auths);
    BatchScanner bs = conn.createBatchScanner(table, auths, numQueryThreads);

    while (true) {
      Set<Text> batch = getBatch(scanner, min, max, batchSize, r);
View Full Code Here

  }
 
  // This test seems to be a little too unstable for a unit test
  @Ignore
  public void test() throws Exception {
    ZooKeeperInstance inst = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
    Connector c = inst.getConnector("root", passwd);
   
    final String table = "foobar";
    c.tableOperations().create(table);
   
    BatchWriter bw = null;
View Full Code Here

   
    int numToScan = Integer.parseInt(args[8]);
   
    RandomAuths randomAuths = new RandomAuths(authsFile);

    Instance instance = new ZooKeeperInstance(instanceName, zooKeepers);
    Connector conn = instance.getConnector(user, password.getBytes());
    Authorizations auths = randomAuths.getAuths(r);
    Scanner scanner = ContinuousUtil.createScanner(conn, table, auths);
   
    double delta = Math.min(.05, .05 / (numToScan / 1000.0));
    // System.out.println("Delta "+delta);
View Full Code Here

public class GCLotsOfCandidatesTest {
  public static void main(String args[]) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
    if (args.length != 4)
      throw new IllegalArgumentException("Expected arguments: <instance name> <zookeeper server> <username> <password>");
   
    Connector conn = new ZooKeeperInstance(args[0], args[1]).getConnector(args[2], args[3].getBytes());
    generateCandidates(conn);
  }
View Full Code Here

   * @see #setMockInstance(Configuration, String)
   */
  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

      r = new Random();
    else {
      r = new Random(Long.parseLong(seed));
    }
   
    ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
    Connector connector = instance.getConnector(user, pass);
    BatchWriter bw = connector.createBatchWriter(table, maxMemory, maxLatency, numThreads);
   
    // reuse the ColumnVisibility object to improve performance
    ColumnVisibility cv = new ColumnVisibility(visiblity);
   
View Full Code Here

   
    // Uncomment the following lines for detailed debugging info
    // Logger logger = Logger.getLogger(Constants.CORE_PACKAGE_NAME);
    // logger.setLevel(Level.TRACE);
   
    ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
    Connector connector = instance.getConnector(user, pass);
    BatchScanner tsbr = connector.createBatchScanner(table, new Authorizations(auths.split(",")), numThreads);
   
    Random r;
    if (seed == null)
      r = new Random();
View Full Code Here

  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

TOP

Related Classes of org.apache.accumulo.core.client.ZooKeeperInstance

Copyright © 2018 www.massapicom. 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.