Package org.apache.accumulo.core.client

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


    if (null == zooKeepers) {
      return null;
    }

    return new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(getInstanceName()).withZkHosts(getZooKeepers()));
  }
View Full Code Here


      if (keepers == null) {
        keepers = conf.get(Property.INSTANCE_ZK_HOST);
      }
    }
    if (instanceId != null) {
      return new ZooKeeperInstance(clientConfig.withInstance(instanceId).withZkHosts(keepers));
    } else {
      return new ZooKeeperInstance(clientConfig.withInstance(instanceName).withZkHosts(keepers));
    }
  }
View Full Code Here

   *
   * @since 1.6.0
   */
  @Override
  public Connector getConnector(String user, String passwd) throws AccumuloException, AccumuloSecurityException {
    Instance instance = new ZooKeeperInstance(getClientConfig());
    return instance.getConnector(user, new PasswordToken(passwd));
  }
View Full Code Here

   */
  public MasterMonitorInfo getMasterMonitorInfo() throws AccumuloException, AccumuloSecurityException {
    MasterClientService.Iface client = null;
    MasterMonitorInfo stats = null;
    try {
      Instance instance = new ZooKeeperInstance(getClientConfig());
      client = MasterClient.getConnectionWithRetry(instance);
      stats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get(instance).toThrift(instance));
    } catch (ThriftSecurityException exception) {
      throw new AccumuloSecurityException(exception);
    } catch (TException exception) {
View Full Code Here

    else if ("ZooKeeperInstance".equals(instanceType)) {
      String clientConfigString = conf.get(enumToConfKey(implementingClass, InstanceOpts.CLIENT_CONFIG));
      if (clientConfigString == null) {
        String instanceName = conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME));
        String zookeepers = conf.get(enumToConfKey(implementingClass, InstanceOpts.ZOO_KEEPERS));
        return new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zookeepers));
      } else {
        return new ZooKeeperInstance(ClientConfiguration.deserialize(clientConfigString));
      }
    } 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

          String instance = DataStoreFactory.findProperty(properties, this, INSTANCE_NAME_PROPERTY, null);
          String zookeepers = DataStoreFactory.findProperty(properties, this, ZOOKEEPERS_NAME_PROPERTY, null);
          credentials = new TCredentials(user,
              "org.apache.accumulo.core.client.security.tokens.PasswordToken",
              ByteBuffer.wrap(password.getBytes()), instance);
          conn = new ZooKeeperInstance(instance, zookeepers).getConnector(user, token);
        } else {
          conn = new MockInstance().getConnector(user, new PasswordToken(password));
          credentials = new TCredentials(user,
              "org.apache.accumulo.core.client.security.tokens.PasswordToken",
              ByteBuffer.wrap(password.getBytes()), conn.getInstance().getInstanceID());
View Full Code Here

   
    String useMock = props.getProperty("useMockInstance");
    if (useMock != null && Boolean.parseBoolean(useMock))
      instance = new MockInstance();
    else
      instance = new ZooKeeperInstance(props.getProperty("instance"), props.getProperty("zookeepers"));
   
    scannerCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).maximumSize(1000).removalListener(new CloseScanner()).build();
   
    writerCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).maximumSize(1000).removalListener(new CloseWriter()).build();
  }
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

    return job.getConfiguration().get(DEFAULT_TABLE_NAME);
  }
 
  protected static Instance getInstance(JobContext job) {
    Configuration conf = job.getConfiguration();
    return new ZooKeeperInstance(conf.get(INSTANCE_NAME), conf.get(ZOOKEEPERS));
  }
View Full Code Here

    String inTable = args[2];
    String outTable = args[3];
    String user = args[4];
    String pass = args[5];
   
    ZooKeeperInstance zki = new ZooKeeperInstance(instance, zooKeepers);
    Connector conn = zki.getConnector(user, pass.getBytes());
   
    Scanner scanner = conn.createScanner(inTable, Constants.NO_AUTHS);
    BatchWriter bw = conn.createBatchWriter(outTable, 50000000, 600000l, 4);
   
    for (Entry<Key,Value> entry : scanner) {
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.