/** * @see #getInstance(org.apache.accumulo.core.client.ClientConfiguration) * @deprecated since 1.7.0, use getInstance(ClientConfiguration) instead. */ @Deprecated public org.apache.accumulo.core.client.Instance getInstance() { return getInstance(org.apache.accumulo.core.client.ClientConfiguration.loadDefault()); }
/** * * @param instanceName * The name of specific accumulo instance. This is set at initialization time. * @param zooKeepers * A comma separated list of zoo keeper server locations. Each location can contain an * optional port, of the format host:port. */ public ZooKeeperInstance(String instanceName, String zooKeepers) { this(ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zooKeepers)); }
/** * Obtain a ClientConfiguration 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 A ClientConfiguration * @since 1.7.0 */ public static org.apache.accumulo.core.client.ClientConfiguration getClientConfiguration( Class<?> implementingClass, Configuration conf) { String clientConfigString = conf .get(enumToConfKey(implementingClass, InstanceOpts.CLIENT_CONFIG)); if (null != clientConfigString) { return org.apache.accumulo.core.client.ClientConfiguration.deserialize(clientConfigString); } String instanceName = conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME)); String zookeepers = conf.get(enumToConfKey(implementingClass, InstanceOpts.ZOO_KEEPERS)); org.apache.accumulo.core.client.ClientConfiguration clientConf = org.apache.accumulo.core.client.ClientConfiguration .loadDefault(); if (null != instanceName) { clientConf.withInstance(instanceName); } if (null != zookeepers) { clientConf.withZkHosts(zookeepers); } return clientConf; }
/** * Enable tracing by setting up SpanReceivers for the current process. If host name is null, it * will be determined. If service name is null, the simple name of the class will be used. */ public static void enable(String hostname, String service) { enable(hostname, service, ClientConfiguration.loadDefault()); }
public static ServerAddress createProxyServer(HostAndPort address, TProtocolFactory protocolFactory, Properties properties) throws Exception { return createProxyServer(address, protocolFactory, properties, ClientConfiguration.loadDefault()); }
/** * @see #getInstance(ClientConfiguration) * @deprecated since 1.7.0, use getInstance(ClientConfiguration) instead. */ @Deprecated public Instance getInstance() { return getInstance(ClientConfiguration.loadDefault()); }
/** * * @param instanceId * The UUID that identifies the accumulo instance you want to connect to. * @param zooKeepers * A comma separated list of zoo keeper server locations. Each location can contain an * optional port, of the format host:port. * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(ClientConfiguration)} instead. */ @Deprecated public ZooKeeperInstance(UUID instanceId, String zooKeepers) { this(ClientConfiguration.loadDefault().withInstance(instanceId).withZkHosts(zooKeepers)); }
/** * * @param instanceName * The name of specific accumulo instance. This is set at initialization time. * @param zooKeepers * A comma separated list of zoo keeper server locations. Each location can contain an * optional port, of the format host:port. */ public ZooKeeperInstance(String instanceName, String zooKeepers) { this(ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zooKeepers)); }
protected static Instance getInstance(Configuration conf) { if (conf.getBoolean(MOCK, false)) return new InMemoryInstance(conf.get(INSTANCE_NAME)); return new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(conf.get(INSTANCE_NAME)).withZkHosts(conf.get(ZOOKEEPERS))); }
/** * Gets an Accumulo instance object. The same instance is reused after the first call. * * @return instance */ public Instance getInstance() { if (instance == null) { String instance = p.getProperty(KEY_INSTANCE); String zookeepers = p.getProperty(KEY_ZOOKEEPERS); this.instance = new ZooKeeperInstance( ClientConfiguration.loadDefault().withInstance(instance).withZkHosts(zookeepers)); } return instance; }
public ClientConfiguration getZookeeperConfig() { return ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zooKeepers); }
public static Connector metricsConnection(Configuration c) throws AccumuloException, AccumuloSecurityException { final String mtxZk = c.get(MetricsConfig.ZOOKEEPERS), mtxInst = c.get(MetricsConfig.INSTANCE), mtxUser = c.get(MetricsConfig.USER), mtxPass = c .get(MetricsConfig.PASS); return new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(mtxInst).withZkHosts(mtxZk)).getConnector(mtxUser, new PasswordToken( mtxPass)); }
/** * Initializes an Accumulo {@link Instance} based on the configuration. * * @param conf * the Hadoop configuration object * @return an accumulo instance * @see #setZooKeeperInstance(Configuration, String, String) * @see #setInMemoryInstance(Configuration, String) */ protected static Instance getInstance(Configuration conf) { if (conf.getBoolean(MOCK, false)) return new InMemoryInstance(conf.get(INSTANCE_NAME)); return new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(conf.get(INSTANCE_NAME)).withZkHosts(conf.get(ZOOKEEPERS))); }
public static Connector warehouseConnection(Configuration c) throws AccumuloException, AccumuloSecurityException { final String whZk = c.get(MetricsConfig.WAREHOUSE_ZOOKEEPERS), whInst = c.get(MetricsConfig.WAREHOUSE_INSTANCE), whUser = c .get(MetricsConfig.WAREHOUSE_USERNAME), whPass = c.get(MetricsConfig.WAREHOUSE_PASSWORD); return new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(whInst).withZkHosts(whZk)).getConnector(whUser, new PasswordToken(whPass)); } }
/** * * @param instanceName * The name of specific accumulo instance. This is set at initialization time. * @param zooKeepers * A comma separated list of zoo keeper server locations. Each location can contain an * optional port, of the format host:port. * @param sessionTimeout * zoo keeper session time out in milliseconds. * @deprecated since 1.6.0; Use {@link #ZooKeeperInstance(ClientConfiguration)} instead. */ @Deprecated public ZooKeeperInstance(String instanceName, String zooKeepers, int sessionTimeout) { this(ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zooKeepers) .withZkTimeout(sessionTimeout)); }
public AccumuloConnectionPoolFactory(String username, String password, String zookeepers, String instanceName) { this.username = username; this.password = password; this.instance = new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zookeepers)); }
public static void configureJob(Job job, int numDays, String instance, String zookeepers, String userName, String password, String outputTable) throws AccumuloSecurityException { job.setNumReduceTasks(Math.min(numDays, 100)); // Cap the number of reducers at 100, just in case we have a large day range (shouldn't really happen // though) job.setReducerClass(MetricsDailySummaryReducer.class); job.setOutputFormatClass(AccumuloOutputFormat.class); AccumuloOutputFormat.setZooKeeperInstance(job, ClientConfiguration.loadDefault().withInstance(instance).withZkHosts(zookeepers)); AccumuloOutputFormat.setConnectorInfo(job, userName, new PasswordToken(password)); AccumuloOutputFormat.setCreateTables(job, true); AccumuloOutputFormat.setDefaultTableName(job, outputTable); }
/** * Construct a <code>ClientConfiguration</code> instance. * * @param zookeepers * ZooKeeper hosts * @param instanceName * Instance name * @param useSasl * Is SASL enabled * @return A ClientConfiguration instance */ public ClientConfiguration getClientConfiguration(String zookeepers, String instanceName, boolean useSasl) { return ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zookeepers).withSasl(useSasl); }
public TCredentials getTCredentials() throws AccumuloSecurityException { Credentials creds = getCredentials(); ZooKeeperInstance instance = new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zooKeepers)); return creds.toThrift(instance); }
public static void main(String[] args) throws Exception { Opts opts = new Opts(); ScannerOpts scanOpts = new ScannerOpts(); BatchWriterOpts bwOpts = new BatchWriterOpts(); opts.parseArgs(RemoveEntriesForMissingFiles.class.getName(), args, scanOpts, bwOpts); checkAllTables(new ClientContext(opts.getInstance(), new Credentials(opts.getPrincipal(), opts.getToken()), ClientConfiguration.loadDefault()), opts.fix); } }