use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ZooKeeperServerMain in project lucene-solr by apache.
the class SolrZkServerProps method start.
public void start() {
if (zkRun == null)
return;
zkThread = new Thread() {
@Override
public void run() {
try {
if (zkProps.getServers().size() > 1) {
QuorumPeerMain zkServer = new QuorumPeerMain();
zkServer.runFromConfig(zkProps);
} else {
ServerConfig sc = new ServerConfig();
sc.readFrom(zkProps);
ZooKeeperServerMain zkServer = new ZooKeeperServerMain();
zkServer.runFromConfig(sc);
}
log.info("ZooKeeper Server exited.");
} catch (Exception e) {
log.error("ZooKeeper Server ERROR", e);
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
}
}
};
if (zkProps.getServers().size() > 1) {
log.info("STARTING EMBEDDED ENSEMBLE ZOOKEEPER SERVER at port " + zkProps.getClientPortAddress().getPort());
} else {
log.info("STARTING EMBEDDED STANDALONE ZOOKEEPER SERVER at port " + zkProps.getClientPortAddress().getPort());
}
zkThread.setDaemon(true);
zkThread.start();
try {
// pause for ZooKeeper to start
Thread.sleep(500);
} catch (Exception e) {
log.error("STARTING ZOOKEEPER", e);
}
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ZooKeeperServerMain in project carbondata by apache.
the class ZooKeeperLockingTest method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
Properties startupProperties = new Properties();
startupProperties.setProperty("dataDir", (new File("./target").getAbsolutePath()));
startupProperties.setProperty("dataLogDir", (new File("./target").getAbsolutePath()));
freePort = findFreePort();
startupProperties.setProperty("clientPort", "" + freePort);
QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
try {
quorumConfiguration.parseProperties(startupProperties);
} catch (Exception e) {
throw new RuntimeException(e);
}
final ZooKeeperServerMain zooKeeperServer = new ZooKeeperServerMain();
final ServerConfig configuration = new ServerConfig();
configuration.readFrom(quorumConfiguration);
new Thread() {
public void run() {
try {
zooKeeperServer.runFromConfig(configuration);
} catch (IOException e) {
System.out.println("ZooKeeper failure");
}
}
}.start();
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ZooKeeperServerMain in project herddb by diennea.
the class ZooKeeperMainWrapper method run.
public void run() throws Exception {
pidFileLocker.lock();
server = new ZooKeeperServerMain();
QuorumPeerConfig qp = new QuorumPeerConfig();
qp.parseProperties(configuration);
ServerConfig sc = new ServerConfig();
sc.readFrom(qp);
server.runFromConfig(sc);
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ZooKeeperServerMain in project thingsboard by thingsboard.
the class KafkaDemoClient method startZkLocal.
private static void startZkLocal() throws Exception {
final File zkTmpDir = File.createTempFile("zookeeper", "test");
if (zkTmpDir.delete() && zkTmpDir.mkdir()) {
Properties zkProperties = new Properties();
zkProperties.setProperty("dataDir", zkTmpDir.getAbsolutePath());
zkProperties.setProperty("clientPort", String.valueOf(ZK_PORT));
ServerConfig configuration = new ServerConfig();
QuorumPeerConfig quorumConfiguration = new QuorumPeerConfig();
quorumConfiguration.parseProperties(zkProperties);
configuration.readFrom(quorumConfiguration);
new Thread() {
public void run() {
try {
new ZooKeeperServerMain().runFromConfig(configuration);
} catch (IOException e) {
System.out.println("Start of Local ZooKeeper Failed");
e.printStackTrace(System.err);
}
}
}.start();
} else {
System.out.println("Failed to delete or create data dir for Zookeeper");
}
}
use of org.apache.flink.shaded.zookeeper3.org.apache.zookeeper.server.ZooKeeperServerMain in project zookeeper by apache.
the class EnforceAuthenticationTest method testServerCannotStart.
private void testServerCannotStart(Map<String, String> prop) throws Exception {
File confFile = getConfFile(prop);
ServerConfig config = new ServerConfig();
config.parse(confFile.toString());
ZooKeeperServerMain serverMain = new ZooKeeperServerMain();
try {
serverMain.runFromConfig(config);
fail("IllegalArgumentException is expected.");
} catch (IllegalArgumentException e) {
// do nothing
}
}
Aggregations