Examples of ZooKeeperInstance


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

 
  @SuppressWarnings("deprecation")
  private static Instance getDefaultInstance(AccumuloConfiguration conf) {
    String keepers = conf.get(Property.INSTANCE_ZK_HOST);
    Path instanceDir = new Path(conf.get(Property.INSTANCE_DFS_DIR), "instance_id");
    return new ZooKeeperInstance(UUID.fromString(ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir)), keepers);
  }
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

   
    String useMock = props.getProperty("useMockInstance");
    if (useMock != null && Boolean.parseBoolean(useMock))
      instance = new MockInstance();
    else
      instance = new ZooKeeperInstance(props.getProperty("instance"), props.getProperty("zookeepers"));
   
    try {
      String tokenProp = props.getProperty("tokenClass", PasswordToken.class.getName());
      tokenClass = Class.forName(tokenProp).asSubclass(AuthenticationToken.class);
    } catch (ClassNotFoundException e) {
View Full Code Here

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

    MiniAccumuloConfig config = new MiniAccumuloConfig(folder.getRoot(), secret)
            .setNumTservers (1);
    accumulo = new MiniAccumuloCluster(config);
    accumulo.start();
    // wait for accumulo to be up and functional
    ZooKeeperInstance zoo = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
    Connector c = zoo.getConnector("root", new PasswordToken(secret.getBytes()));
    for (@SuppressWarnings("unused") Entry<org.apache.accumulo.core.data.Key,Value> entry : c.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS))
        ;
   
    Properties props = new Properties();
    props.put("instance", accumulo.getInstanceName());
View Full Code Here

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

      };
      this.zookeepers = config.get(Property.INSTANCE_ZK_HOST);
      Path instanceDir = new Path(config.get(Property.INSTANCE_DFS_DIR), "instance_id");
      @SuppressWarnings("deprecation")
      String instanceIDFromFile = ZooKeeperInstance.getInstanceIDFromHdfs(instanceDir);
      return cachedInstance = new ZooKeeperInstance(UUID.fromString(instanceIDFromFile), zookeepers);
    }
    return cachedInstance = new ZooKeeperInstance(this.instance, this.zookeepers);
  }
View Full Code Here

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

    for (int i = 0; i < 9 && !success; i++) {
      try {
        exec("insert a b c d -l foo", false, "does not have authorization", true, new ErrorMessageCallback() {
          public String getErrorMessage() {
            try {
              Connector c = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers()).getConnector("root", new PasswordToken(secret));
              return "Current auths for root are: " + c.securityOperations().getUserAuthorizations("root").toString();
            } catch (Exception e) {
              return "Could not check authorizations";
            }
          }
        });
        success = true;
      } catch (AssertionError e) {
        Thread.sleep(200);
      }
    }
    // If we still couldn't do it, try again and let it fail
    if (!success) {
      exec("insert a b c d -l foo", false, "does not have authorization", true, new ErrorMessageCallback() {
        public String getErrorMessage() {
          try {
            Connector c = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers()).getConnector("root", new PasswordToken(secret));
            return "Current auths for root are: " + c.securityOperations().getUserAuthorizations("root").toString();
          } catch (Exception e) {
            return "Could not check authorizations";
          }
        }
View Full Code Here

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

    // Should be about a 3 second scan
    for (int i = 0; i < 6; i++) {
      exec("insert " + i + " cf cq value", true);
    }

    ZooKeeperInstance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector connector = instance.getConnector("root", new PasswordToken(secret));
    final Scanner s = connector.createScanner(table, Constants.NO_AUTHS);
    IteratorSetting cfg = new IteratorSetting(30, SlowIterator.class);
    cfg.addOption("sleepTime", "500");
    s.addScanIterator(cfg);
View Full Code Here

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

  private int countFiles(String tableId) throws IOException {
    return getFiles(tableId).size();
  }
 
  private String getTableId(String tableName) throws Exception {
    ZooKeeperInstance zki = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector conn = zki.getConnector("root", new PasswordToken(secret));
   
    for (int i = 0; i < 5; i++) {
      Map<String,String> nameToId = conn.tableOperations().tableIdMap();
      if (nameToId.containsKey(tableName)) {
        return nameToId.get(tableName);
View Full Code Here

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

    folder.delete();
  }
 
  @Test
  public void testTableRenameDataValidation() 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, 60, TimeUnit.SECONDS);

    try {
      final String table1 = "testTableRenameDataValidation_table1", table2 = "testTableRenameDataValidation_table2";
View Full Code Here

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

    }
  }

  @Test
  public void testTableRenameSameWriters() 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, 60, TimeUnit.SECONDS);

    try {
      final String table1 = "testTableRenameSameWriters_table1", table2 = "testTableRenameSameWriters_table2";
      final String newTable1 = "testTableRenameSameWriters_newTable1", newTable2 = "testTableRenameSameWriters_newTable2";
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.