- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.accumulo.core.client.ZooKeeperInstance.getConnector()
方法的一些代码示例,展示了ZooKeeperInstance.getConnector()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperInstance.getConnector()
方法的具体详情如下:
包路径:org.apache.accumulo.core.client.ZooKeeperInstance
类名称:ZooKeeperInstance
方法名:getConnector
暂无
代码示例来源:origin: brianfrankcooper/YCSB
@Override
public void init() throws DBException {
colFam = new Text(getProperties().getProperty("accumulo.columnFamily"));
colFamBytes = colFam.toString().getBytes(UTF_8);
inst = new ZooKeeperInstance(
getProperties().getProperty("accumulo.instanceName"),
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.");
}
}
代码示例来源:origin: brianfrankcooper/YCSB
@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.");
}
}
代码示例来源:origin: brianfrankcooper/YCSB
@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.");
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
@Deprecated
public Connector getConnector(String user, CharSequence pass)
throws AccumuloException, AccumuloSecurityException {
return getConnector(user, TextUtil.getBytes(new Text(pass.toString())));
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
@Deprecated
public Connector getConnector(String principal, byte[] pass)
throws AccumuloException, AccumuloSecurityException {
return getConnector(principal, new PasswordToken(pass));
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
@Deprecated
public Connector getConnector(String user, ByteBuffer pass)
throws AccumuloException, AccumuloSecurityException {
return getConnector(user, ByteBufferUtil.toBytes(pass));
}
代码示例来源:origin: org.apache.accumulo/examples-simple
public QueryUtil(String instanceName, String zooKeepers, String user, String password, String tableName, Authorizations auths) throws AccumuloException,
AccumuloSecurityException {
ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
conn = instance.getConnector(user, password.getBytes());
this.tableName = tableName;
this.auths = auths;
}
代码示例来源:origin: org.apache.accumulo/examples-simple
private static BatchWriter setupBatchWriter(String instance, String zooKeepers, String table, String user, String pass) throws Exception {
ZooKeeperInstance zinstance = new ZooKeeperInstance(instance, zooKeepers);
Connector conn = zinstance.getConnector(user, pass.getBytes());
return conn.createBatchWriter(table, 50000000, 300000l, 4);
}
代码示例来源:origin: org.apache.accumulo/examples-simple
public FileDataQuery(String instanceName, String zooKeepers, String user, String password, String tableName, Authorizations auths) throws AccumuloException,
AccumuloSecurityException, TableNotFoundException {
ZooKeeperInstance instance = new ZooKeeperInstance(instanceName, zooKeepers);
conn = instance.getConnector(user, password.getBytes());
lastRefs = new ArrayList<Entry<Key,Value>>();
cis = new ChunkInputStream();
scanner = conn.createScanner(tableName, auths);
}
代码示例来源:origin: Accla/graphulo
@SuppressWarnings("unused") // used in D4M
public TriangleIngestor(final String instanceName, final String zookeepers, final String username, final String password) throws AccumuloSecurityException, AccumuloException {
this(new ZooKeeperInstance(instanceName, zookeepers).getConnector(username, new PasswordToken(password)));
}
public TriangleIngestor(final Connector connector) {
代码示例来源:origin: NationalSecurityAgency/datawave
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));
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
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));
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public Void run() throws Exception {
ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
try {
inst.getConnector(userWithoutCredentials3, new KerberosToken(userWithoutCredentials3));
Assert.fail("Should not be able to create a Connector as this user cannot be proxied");
} catch (org.apache.accumulo.core.client.AccumuloSecurityException e) {
// Expected, this user cannot be proxied
}
return null;
}
});
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public Void run() throws Exception {
ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
Connector conn = inst.getConnector(userWithoutCredentials1,
new KerberosToken(userWithoutCredentials1));
Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
assertFalse(s.iterator().hasNext());
return null;
}
});
代码示例来源:origin: org.neolumin.vertexium/vertexium-accumulo
public Connector createConnector() throws AccumuloSecurityException, AccumuloException {
LOGGER.info("Connecting to accumulo instance [{}] zookeeper servers [{}]", this.getAccumuloInstanceName(), this.getZookeeperServers());
ZooKeeperInstance instance = new ZooKeeperInstance(this.getAccumuloInstanceName(), this.getZookeeperServers());
return instance.getConnector(this.getAccumuloUsername(), this.getAuthenticationToken());
}
代码示例来源:origin: lumifyio/securegraph
public Connector createConnector() throws AccumuloSecurityException, AccumuloException {
LOGGER.info("Connecting to accumulo instance [{}] zookeeper servers [{}]", this.getAccumuloInstanceName(), this.getZookeeperServers());
ZooKeeperInstance instance = new ZooKeeperInstance(this.getAccumuloInstanceName(), this.getZookeeperServers());
return instance.getConnector(this.getAccumuloUsername(), this.getAuthenticationToken());
}
代码示例来源:origin: org.vertexium/vertexium-accumulo
public Connector createConnector() {
try {
LOGGER.info("Connecting to accumulo instance [%s] zookeeper servers [%s]", this.getAccumuloInstanceName(), this.getZookeeperServers());
ZooKeeperInstance instance = new ZooKeeperInstance(getClientConfiguration());
return instance.getConnector(this.getAccumuloUsername(), this.getAuthenticationToken());
} catch (Exception ex) {
throw new VertexiumException(
String.format("Could not connect to Accumulo instance [%s] zookeeper servers [%s]", this.getAccumuloInstanceName(), this.getZookeeperServers()),
ex
);
}
}
代码示例来源:origin: org.apache.fluo/fluo-recipes-accumulo
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;
}
代码示例来源:origin: io.fluo/fluo-recipes-accumulo
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;
}
代码示例来源:origin: locationtech/geowave
public OsmProvider(final OSMIngestCommandArgs args, final AccumuloRequiredOptions store)
throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
conn =
new ZooKeeperInstance(store.getInstance(), store.getZookeeper()).getConnector(
store.getUser(),
new PasswordToken(store.getPassword()));
bs =
conn.createBatchScanner(
args.getQualifiedTableName(),
new Authorizations(args.getVisibilityOptions().getVisibility()),
1);
}
本文整理了Java中org.apache.accumulo.core.client.ZooKeeperInstance.getConnector()方法的一些代码示例,展示了ZooKeeperInst
我是一名优秀的程序员,十分优秀!