use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ServerConfig in project jmxtrans by jmxtrans.
the class EmbeddedZookeeper method before.
@Override
public void before() throws Exception {
LOGGER.info("Starting Zookeeper");
Properties properties = getResourceAsProperties("zookeeper.properties");
dataDir = temporaryFolder.newFolder("zookeeper");
properties.setProperty("dataDir", dataDir.getAbsolutePath());
QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
try {
quorumConfiguration.parseProperties(properties);
} catch (Exception e) {
throw new RuntimeException(e);
}
final ServerConfig configuration = new ServerConfig();
configuration.readFrom(quorumConfiguration);
// Start Zookeeper in separate thread
executor.execute(new Runnable() {
@Override
public void run() {
runServer(configuration);
}
});
// Wait for Zookeeper to be started
await().atMost(5, TimeUnit.SECONDS).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return getServerCnxnFactory() != null;
}
});
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ServerConfig in project hbase by apache.
the class HQuorumPeer method runZKServer.
private static void runZKServer(QuorumPeerConfig zkConfig) throws IOException, AdminServer.AdminServerException {
/**
* Start and schedule the purge task
* autopurge.purgeInterval is 0 by default,so in fact the DatadirCleanupManager task will not
* be started to clean the logs by default. Config is recommended only for standalone server.
*/
DatadirCleanupManager purgeMgr = new DatadirCleanupManager(zkConfig.getDataDir(), zkConfig.getDataLogDir(), zkConfig.getSnapRetainCount(), zkConfig.getPurgeInterval());
purgeMgr.start();
if (zkConfig.isDistributed()) {
QuorumPeerMain qp = new QuorumPeerMain();
qp.runFromConfig(zkConfig);
} else {
ZooKeeperServerMain zk = new ZooKeeperServerMain();
ServerConfig serverConfig = new ServerConfig();
serverConfig.readFrom(zkConfig);
zk.runFromConfig(serverConfig);
}
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ServerConfig in project xian by happyyangyuan.
the class TestingZooKeeperMain method runFromConfig.
@Override
public void runFromConfig(QuorumPeerConfig config) throws Exception {
ServerConfig serverConfig = new ServerConfig();
serverConfig.readFrom(config);
latch.countDown();
try {
super.runFromConfig(serverConfig);
} catch (IOException e) {
startingException.set(e);
throw e;
}
}
Aggregations