本文整理了Java中com.dremio.service.coordinator.zk.ZKClusterCoordinator
类的一些代码示例,展示了ZKClusterCoordinator
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKClusterCoordinator
类的具体详情如下:
包路径:com.dremio.service.coordinator.zk.ZKClusterCoordinator
类名称:ZKClusterCoordinator
[英]Manages cluster coordination utilizing zookeeper.
[中]利用zookeeper管理集群协调。
代码示例来源:origin: dremio/dremio-oss
public int submitQuery(String planLocation, String queryString, String type, String zkQuorum, boolean local, int bits, String format, int width) throws Exception {
SabotConfig config = SabotConfig.create();
Preconditions.checkArgument(!local, "Can only run remote.");
DremioClient client = null;
Preconditions.checkArgument(!(planLocation == null && queryString == null), "Must provide either query file or query string");
Preconditions.checkArgument(!(planLocation != null && queryString != null), "Must provide either query file or query string, not both");
try {
ZKClusterCoordinator clusterCoordinator = new ZKClusterCoordinator(config, zkQuorum);
clusterCoordinator.start();
client = new DremioClient(config, clusterCoordinator);
client.connect();
String plan;
if (queryString == null) {
plan = Charsets.UTF_8.decode(ByteBuffer.wrap(Files.readAllBytes(Paths.get(planLocation)))).toString();
} else {
plan = queryString;
}
return submitQuery(client, plan, type, format, width);
} catch(Throwable th) {
System.err.println("Query Failed due to : " + th.getMessage());
return -1;
} finally {
if (client != null) {
client.close();
}
}
}
代码示例来源:origin: dremio/dremio-oss
/**
* Kill the given ZK session
*
* @param clusterCoordinator the cluster coordinator owning the session
*/
public static void kill(ZKClusterCoordinator clusterCoordinator) throws Exception {
KillSession.kill(clusterCoordinator.getZkClient().getZooKeeperClient(), clusterCoordinator.getZkClient().getConnectionString());
}
代码示例来源:origin: dremio/dremio-oss
if (clusterCoordinator == null) {
try {
clusterCoordinator = new ZKClusterCoordinator(this.config, connect);
clusterCoordinator.start();
} catch (Exception e) {
代码示例来源:origin: dremio/dremio-oss
coord = new ZKClusterCoordinator(config.getSabotConfig(), portProvider);
} catch (IOException e) {
throw new RuntimeException("Cannot instantiate the ZooKeeper cluster coordinator", e);
代码示例来源:origin: dremio/dremio-oss
@Test
public void testGivingUpLeadership() throws Exception {
try(ZKClusterCoordinator coordinator = new ZKClusterCoordinator(
DEFAULT_SABOT_CONFIG,
String.format("%s/dremio/test/test-cluster-id", zooKeeperServer.getConnectString()))
) {
coordinator.start();
代码示例来源:origin: dremio/dremio-oss
@Test
public void testElectionsWithRegistration() throws Exception {
try(ZKClusterCoordinator coordinator = new ZKClusterCoordinator(
DEFAULT_SABOT_CONFIG,
String.format("%s/dremio/test/test-cluster-id", zooKeeperServer.getConnectString()))
) {
coordinator.start();
内容来源于网络,如有侵权,请联系作者删除!