use of org.apache.curator.ensemble.fixed.FixedEnsembleProvider in project hadoop by apache.
the class MicroZookeeperService method serviceStart.
/**
* Startup: start ZK. It is only after this that
* the binding information is valid.
* @throws Exception
*/
@Override
protected void serviceStart() throws Exception {
setupSecurity();
ZooKeeperServer zkServer = new ZooKeeperServer();
FileTxnSnapLog ftxn = new FileTxnSnapLog(dataDir, dataDir);
zkServer.setTxnLogFactory(ftxn);
zkServer.setTickTime(tickTime);
LOG.info("Starting Local Zookeeper service");
factory = ServerCnxnFactory.createFactory();
factory.configure(getAddress(port), -1);
factory.startup(zkServer);
String connectString = getConnectionString();
LOG.info("In memory ZK started at {}\n", connectString);
if (LOG.isDebugEnabled()) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
zkServer.dumpConf(pw);
pw.flush();
LOG.debug(sw.toString());
}
binding = new BindingInformation();
binding.ensembleProvider = new FixedEnsembleProvider(connectString);
binding.description = getName() + " reachable at \"" + connectString + "\"";
addDiagnostics(binding.description);
// finally: set the binding information in the config
getConfig().set(KEY_REGISTRY_ZK_QUORUM, connectString);
}
use of org.apache.curator.ensemble.fixed.FixedEnsembleProvider in project hadoop by apache.
the class CuratorService method supplyBindingInformation.
/**
* Supply the binding information.
* This implementation returns a fixed ensemble bonded to
* the quorum supplied by {@link #buildConnectionString()}
* @return the binding information
*/
@Override
public BindingInformation supplyBindingInformation() {
BindingInformation binding = new BindingInformation();
String connectString = buildConnectionString();
binding.ensembleProvider = new FixedEnsembleProvider(connectString);
binding.description = "fixed ZK quorum \"" + connectString + "\"";
return binding;
}
Aggregations