本文整理了Java中org.apache.accumulo.core.client.Instance.getZooKeepers()
方法的一些代码示例,展示了Instance.getZooKeepers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instance.getZooKeepers()
方法的具体详情如下:
包路径:org.apache.accumulo.core.client.Instance
类名称:Instance
方法名:getZooKeepers
[英]Returns a comma-separated list of zookeeper servers the instance is using.
[中]返回实例正在使用的zookeeper服务器的逗号分隔列表。
代码示例来源:origin: prestodb/presto
public static synchronized DistributedQueryRunner createAccumuloQueryRunner(Map<String, String> extraProperties)
throws Exception
{
DistributedQueryRunner queryRunner =
new DistributedQueryRunner(createSession(), 4, extraProperties);
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
queryRunner.installPlugin(new AccumuloPlugin());
Map<String, String> accumuloProperties =
ImmutableMap.<String, String>builder()
.put(AccumuloConfig.INSTANCE, connector.getInstance().getInstanceName())
.put(AccumuloConfig.ZOOKEEPERS, connector.getInstance().getZooKeepers())
.put(AccumuloConfig.USERNAME, MAC_USER)
.put(AccumuloConfig.PASSWORD, MAC_PASSWORD)
.put(AccumuloConfig.ZOOKEEPER_METADATA_ROOT, "/presto-accumulo-test")
.build();
queryRunner.createCatalog("accumulo", "accumulo", accumuloProperties);
if (!tpchLoaded) {
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), TpchTable.getTables());
connector.tableOperations().addSplits("tpch.orders", ImmutableSortedSet.of(new Text(new LexicoderRowSerializer().encode(BIGINT, 7500L))));
tpchLoaded = true;
}
return queryRunner;
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
private static ZooCache getZooCache(Instance instance) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(TABLES_PERMISSION);
}
return new ZooCacheFactory().getZooCache(instance.getZooKeepers(),
instance.getZooKeepersSessionTimeOut());
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public ZooCache call() {
final String zks = instance.getZooKeepers();
final int timeOut = instance.getZooKeepersSessionTimeOut();
return new ZooCacheFactory().getZooCache(zks, timeOut, new Watcher() {
@Override
public void process(WatchedEvent watchedEvent) {
instanceToMapCache.invalidate(uuid);
}
});
}
});
代码示例来源:origin: prestodb/presto
public TestAccumuloClient()
throws Exception
{
AccumuloConfig config = new AccumuloConfig()
.setUsername("root")
.setPassword("secret");
Connector connector = AccumuloQueryRunner.getAccumuloConnector();
config.setZooKeepers(connector.getInstance().getZooKeepers());
zooKeeperMetadataManager = new ZooKeeperMetadataManager(config, new TypeRegistry());
client = new AccumuloClient(connector, config, zooKeeperMetadataManager, new AccumuloTableManager(connector), new IndexLookup(connector, new ColumnCardinalityCache(connector, config)));
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
ZookeeperLockChecker(Instance instance, ZooCacheFactory zcf) {
zc = zcf.getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
this.root = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
@Override
public void execute(final String[] args) throws KeeperException, InterruptedException {
Instance instance = HdfsZooInstance.getInstance();
System.out.println("monitor: " + MonitorUtil.getLocation(instance));
System.out.println("masters: " + instance.getMasterLocations());
System.out.println("zookeepers: " + instance.getZooKeepers());
}
代码示例来源:origin: org.apache.accumulo/accumulo-shell
protected synchronized IZooReaderWriter getZooReaderWriter(Instance instance, String secret) {
if (secret == null) {
AccumuloConfiguration conf = SiteConfiguration.getInstance();
secret = conf.get(Property.INSTANCE_SECRET);
}
return new ZooReaderWriter(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(),
SCHEME, (USER + ":" + secret).getBytes());
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
public static void main(String[] args) {
Instance instance = HdfsZooInstance.getInstance();
System.out.println("Instance Name: " + instance.getInstanceName());
System.out.println("Instance ID: " + instance.getInstanceID());
System.out.println("ZooKeepers: " + instance.getZooKeepers());
System.out.println("Masters: " + Joiner.on(", ").join(instance.getMasterLocations()));
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
private static void deleteInstance(Instance origInstance, String oldPass) throws Exception {
IZooReaderWriter orig = new ZooReaderWriter(origInstance.getZooKeepers(), origInstance.getZooKeepersSessionTimeOut(), oldPass);
orig.recursiveDelete("/accumulo/" + origInstance.getInstanceID(), NodeMissingPolicy.SKIP);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public void run() {
try {
CacheTestReader.main(new String[] {pathName, testDir.getAbsolutePath(),
getConnector().getInstance().getZooKeepers()});
} catch (Exception ex) {
ref.set(ex);
}
}
};
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public void invalidateCache(Instance instance, String server) {
ZooCache zooCache = zcf.getZooCache(instance.getZooKeepers(),
instance.getZooKeepersSessionTimeOut());
String root = ZooUtil.getRoot(instance) + Constants.ZTSERVERS;
zooCache.clear(root + "/" + server);
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
public static String getLocation(Instance instance) throws KeeperException, InterruptedException {
ZooReader zr = new ZooReader(instance.getZooKeepers(), 30000);
byte[] loc = zr.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR_HTTP_ADDR, null);
return loc == null ? null : new String(loc, UTF_8);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
private void initializeZooCache() {
synchronized (initLock) {
if (null == tablePropCache) {
tablePropCache = new ZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut(), new TableConfWatcher(instance));
}
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public static void main(String[] args) {
Instance instance = HdfsZooInstance.getInstance();
System.out.println("Instance Name: " + instance.getInstanceName());
System.out.println("Instance ID: " + instance.getInstanceID());
System.out.println("ZooKeepers: " + instance.getZooKeepers());
System.out.println("Masters: " + StringUtil.join(instance.getMasterLocations(), ", "));
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
synchronized public static ZooConfiguration getInstance(Instance inst, AccumuloConfiguration parent) {
if (instance == null) {
propCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut());
instance = new ZooConfiguration(parent);
instanceId = inst.getInstanceID();
}
return instance;
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public static void main(String[] args) throws Exception {
ZooReaderWriter zrw = ZooReaderWriter.getInstance();
Instance instance = HdfsZooInstance.getInstance();
System.out.println("monitor: " + new String(zrw.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR_HTTP_ADDR, null), UTF_8));
System.out.println("masters: " + instance.getMasterLocations());
System.out.println("zookeepers: " + instance.getZooKeepers());
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server-base
private static void deleteInstance(Instance origInstance, String oldPass) throws Exception {
IZooReaderWriter orig = new ZooReaderWriter(origInstance.getZooKeepers(),
origInstance.getZooKeepersSessionTimeOut(), oldPass);
orig.recursiveDelete("/accumulo/" + origInstance.getInstanceID(), NodeMissingPolicy.SKIP);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Test(expected = RuntimeException.class)
public void invalidInstanceName() throws Exception {
final Connector conn = getConnector();
new ZooKeeperInstance("fake_instance_name", conn.getInstance().getZooKeepers());
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
private Map<String,Boolean> _getWals(Connector c) throws Exception {
Map<String,Boolean> result = new HashMap<>();
Instance i = c.getInstance();
ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
"");
WalStateManager wals = new WalStateManager(c.getInstance(), zk);
for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
// WALs are in use if they are not unreferenced
result.put(entry.getKey().toString(), entry.getValue() != WalState.UNREFERENCED);
}
return result;
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
public static IteratorSetting iteratorSetting(int priority, int sleepAfterFirstWrite,
long batchWriterTimeout, long batchWriterMaxMemory, int numEntriesToWrite, String tableName,
Connector connector, AuthenticationToken token, boolean clearCacheAfterFirstWrite,
boolean splitAfterFirstWrite) {
return iteratorSetting(priority, sleepAfterFirstWrite, batchWriterTimeout, batchWriterMaxMemory,
numEntriesToWrite, tableName, connector.getInstance().getZooKeepers(),
connector.getInstance().getInstanceName(),
connector.getInstance().getZooKeepersSessionTimeOut(), connector.whoami(), token,
clearCacheAfterFirstWrite, splitAfterFirstWrite);
}
内容来源于网络,如有侵权,请联系作者删除!