@Override public void init() throws DBException { colFam = new Text(getProperties().getProperty("accumulo.columnFamily")); colFamBytes = colFam.toString().getBytes(UTF_8); inst = new ZooKeeperInstance(new ClientConfiguration() .withInstance(getProperties().getProperty("accumulo.instanceName")) .withZkHosts(getProperties().getProperty("accumulo.zooKeepers"))); try { String principal = getProperties().getProperty("accumulo.username"); AuthenticationToken token = new PasswordToken(getProperties().getProperty("accumulo.password")); connector = inst.getConnector(principal, token); } catch (AccumuloException | AccumuloSecurityException e) { throw new DBException(e); } if (!(getProperties().getProperty("accumulo.pcFlag", "none").equals("none"))) { System.err.println("Sorry, the ZK based producer/consumer implementation has been removed. " + "Please see YCSB issue #416 for work on adding a general solution to coordinated work."); } }
@Override public void init() throws DBException { colFam = new Text(getProperties().getProperty("accumulo.columnFamily")); colFamBytes = colFam.toString().getBytes(UTF_8); inst = new ZooKeeperInstance(new ClientConfiguration() .withInstance(getProperties().getProperty("accumulo.instanceName")) .withZkHosts(getProperties().getProperty("accumulo.zooKeepers"))); try { String principal = getProperties().getProperty("accumulo.username"); AuthenticationToken token = new PasswordToken(getProperties().getProperty("accumulo.password")); connector = inst.getConnector(principal, token); } catch (AccumuloException | AccumuloSecurityException e) { throw new DBException(e); } if (!(getProperties().getProperty("accumulo.pcFlag", "none").equals("none"))) { System.err.println("Sorry, the ZK based producer/consumer implementation has been removed. " + "Please see YCSB issue #416 for work on adding a general solution to coordinated work."); } }
/** * * @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)); }
/** * Configures a {@link org.apache.accumulo.core.client.ZooKeeperInstance} for this job. * * @param job * the Hadoop job instance to be configured * @param instanceName * the Accumulo instance name * @param zooKeepers * a comma-separated list of zookeeper servers * @since 1.5.0 * @deprecated since 1.6.0 */ @Deprecated public static void setZooKeeperInstance(Job job, String instanceName, String zooKeepers) { setZooKeeperInstance(job, org.apache.accumulo.core.client.ClientConfiguration.create() .withInstance(instanceName).withZkHosts(zooKeepers)); }
/** * Configures a {@link org.apache.accumulo.core.client.ZooKeeperInstance} for this job. * * @param job * the Hadoop job instance to be configured * @param instanceName * the Accumulo instance name * @param zooKeepers * a comma-separated list of zookeeper servers * @since 1.5.0 * @deprecated since 1.6.0; Use * {@link #setZooKeeperInstance(Job, org.apache.accumulo.core.client.ClientConfiguration)} * instead. */ @Deprecated public static void setZooKeeperInstance(Job job, String instanceName, String zooKeepers) { setZooKeeperInstance(job, org.apache.accumulo.core.client.ClientConfiguration.create() .withInstance(instanceName).withZkHosts(zooKeepers)); }
/** * Configures a {@link org.apache.accumulo.core.client.ZooKeeperInstance} for this job. * * @param job * the Hadoop job instance to be configured * @param instanceName * the Accumulo instance name * @param zooKeepers * a comma-separated list of zookeeper servers * @since 1.5.0 * @deprecated since 1.6.0; Use * {@link #setZooKeeperInstance(JobConf, org.apache.accumulo.core.client.ClientConfiguration)} * instead. */ @Deprecated public static void setZooKeeperInstance(JobConf job, String instanceName, String zooKeepers) { setZooKeeperInstance(job, org.apache.accumulo.core.client.ClientConfiguration.create() .withInstance(instanceName).withZkHosts(zooKeepers)); }
/** * Configures a {@link org.apache.accumulo.core.client.ZooKeeperInstance} for this job. * * @param job * the Hadoop job instance to be configured * @param instanceName * the Accumulo instance name * @param zooKeepers * a comma-separated list of zookeeper servers * @since 1.5.0 * @deprecated since 1.6.0; Use * {@link #setZooKeeperInstance(JobConf, org.apache.accumulo.core.client.ClientConfiguration)} * instead. */ @Deprecated public static void setZooKeeperInstance(JobConf job, String instanceName, String zooKeepers) { setZooKeeperInstance(job, org.apache.accumulo.core.client.ClientConfiguration.create() .withInstance(instanceName).withZkHosts(zooKeepers)); }
public org.apache.accumulo.core.client.Instance getInstance( org.apache.accumulo.core.client.ClientConfiguration base) { if (null == instanceName) { return null; } if (null == zooKeepers) { return null; } return new org.apache.accumulo.core.client.ZooKeeperInstance( base.withInstance(getInstanceName()).withZkHosts(getZooKeepers())); }
/** * 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; }
/** * Construct an {@link Instance} entry point to Accumulo using a {@link MiniAccumuloCluster} * directory */ public MiniAccumuloInstance(String instanceName, File directory) throws FileNotFoundException { super(ClientConfiguration.fromFile(new File(new File(directory, "conf"), "client.conf")) .withInstance(instanceName).withZkHosts(getZooKeepersFromDir(directory))); }
/** * * @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)); }
public static void setOutputInfo(Job job, String instanceName, String zooKeepers, String principal, AuthenticationToken token) throws AccumuloSecurityException { AccumuloOutputFormat.setConnectorInfo(job, principal, token); ClientConfiguration clientConfig = ClientConfiguration.create() .withInstance(instanceName) .withZkHosts(zooKeepers); AccumuloOutputFormat.setZooKeeperInstance(job, clientConfig); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Mutation.class); }
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); }
@SuppressWarnings("unchecked") public ClientConfiguration getClientConfiguration() { ClientConfiguration config = ClientConfiguration.create() .withInstance(this.getAccumuloInstanceName()) .withZkHosts(this.getZookeeperServers()); for (Map.Entry<String, String> entry : getClientConfigurationProperties().entrySet()) { config.setProperty(entry.getKey(), entry.getValue()); } return config; }
@Override public ClientConfiguration getClientConfig() { return ClientConfiguration.fromMap(config.getSiteConfig()).withInstance(this.getInstanceName()) .withZkHosts(this.getZooKeepers()); }
public Instance getInstance(ClientConfiguration base) { if (null == instanceName) { return null; } if (isMockInstance()) { return DeprecationUtil.makeMockInstance(getInstanceName()); } if (null == zooKeepers) { return null; } return new ZooKeeperInstance(base.withInstance(getInstanceName()).withZkHosts(getZooKeepers())); }
/** * Creates Accumulo instance given FluoConfiguration */ public static Instance getInstance(FluoConfiguration config) { ClientConfiguration clientConfig = new ClientConfiguration() .withInstance(config.getAccumuloInstance()).withZkHosts(config.getAccumuloZookeepers()) .withZkTimeout(config.getZookeeperTimeout() / 1000); return new ZooKeeperInstance(clientConfig); }
/** * Creates Accumulo instance given FluoConfiguration */ public static Instance getInstance(FluoConfiguration config) { ClientConfiguration clientConfig = new ClientConfiguration().withInstance(config.getAccumuloInstance()) .withZkHosts(config.getAccumuloZookeepers()) .withZkTimeout(config.getZookeeperTimeout() / 1000); return new ZooKeeperInstance(clientConfig); }
private static Connector getConnector(FluoConfiguration fluoConfig) throws Exception { ZooKeeperInstance zki = new ZooKeeperInstance( new ClientConfiguration().withInstance(fluoConfig.getAccumuloInstance()) .withZkHosts(fluoConfig.getAccumuloZookeepers())); Connector conn = zki.getConnector(fluoConfig.getAccumuloUser(), new PasswordToken(fluoConfig.getAccumuloPassword())); return conn; }
private static Connector getConnector(FluoConfiguration fluoConfig) throws Exception { ZooKeeperInstance zki = new ZooKeeperInstance(new ClientConfiguration().withInstance( fluoConfig.getAccumuloInstance()).withZkHosts(fluoConfig.getAccumuloZookeepers())); Connector conn = zki.getConnector(fluoConfig.getAccumuloUser(), new PasswordToken(fluoConfig.getAccumuloPassword())); return conn; }