private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { 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); } }
/** * To start the replicated server specify the configuration file name on * the command line. * @param args path to the configfile */ public static void main(String[] args) { QuorumPeerMain main = new QuorumPeerMain(); try { main.initializeAndRun(args); } catch (IllegalArgumentException e) { LOG.error("Invalid arguments, exiting abnormally", e); LOG.info(USAGE); System.err.println(USAGE); System.exit(2); } catch (ConfigException e) { LOG.error("Invalid config, exiting abnormally", e); System.err.println("Invalid config, exiting abnormally"); System.exit(2); } catch (Exception e) { LOG.error("Unexpected exception, exiting abnormally", e); System.exit(1); } LOG.info("Exiting normally"); System.exit(0); }
@Override public void runFromConfig(QuorumPeerConfig config) throws IOException { quorumPeer = QuorumPeer.testingQuorumPeer(); super.runFromConfig(config); }
@Override public void run() { QuorumPeerMain.main(new String[] { confName }); } }, "Embed ZooKeeper");
@Override protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServer.AdminServerException { super.initializeAndRun(args); } }.initializeAndRun(args);
config.getMaxClientCnxns()); quorumPeer = getQuorumPeer();
protected void initializeAndRun(String[] args) throws ConfigException, IOException { QuorumPeerConfig config = new QuorumPeerConfig(); if (args.length == 1) { config.parse(args[0]); } // Start and schedule the the purge task DatadirCleanupManager purgeMgr = new DatadirCleanupManager(config .getDataDir(), config.getDataLogDir(), config .getSnapRetainCount(), config.getPurgeInterval()); purgeMgr.start(); if (args.length == 1 && config.servers.size() > 0) { runFromConfig(config); } else { LOG.warn("Either no config or no quorum defined in config, running " + " in standalone mode"); // there is only server in the quorum -- run as standalone ZooKeeperServerMain.main(args); } }
@Override protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServer.AdminServerException { super.initializeAndRun(args); } }.initializeAndRun(args);
quorumPeer = getQuorumPeer(); quorumPeer.setRootMetricsContext(metricsProvider.getRootContext()); quorumPeer.setTxnFactory(new FileTxnSnapLog(
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { 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); } }
QuorumPeerMain main = new QuorumPeerMain(); try { main.initializeAndRun(args); } catch (IllegalArgumentException e) { LOG.error("Invalid arguments, exiting abnormally", e);
protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServerException { QuorumPeerConfig config = new QuorumPeerConfig(); if (args.length == 1) { config.parse(args[0]); } // Start and schedule the the purge task DatadirCleanupManager purgeMgr = new DatadirCleanupManager(config .getDataDir(), config.getDataLogDir(), config .getSnapRetainCount(), config.getPurgeInterval()); purgeMgr.start(); if (args.length == 1 && config.isDistributed()) { runFromConfig(config); } else { LOG.warn("Either no config or no quorum defined in config, running " + " in standalone mode"); // there is only server in the quorum -- run as standalone ZooKeeperServerMain.main(args); } }
/** * Start zookeeper server. */ @Override public void run() { Thread.currentThread().setName("zookeeper server thread"); QuorumPeerMain.main(new String[]{"zoo.cfg"}); } }
@Override protected void initializeAndRun(String[] args) throws ConfigException, IOException, AdminServer.AdminServerException { super.initializeAndRun(args); } }.initializeAndRun(args);
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { 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); } }
/** * To start the replicated server specify the configuration file name on * the command line. * @param args path to the configfile */ public static void main(String[] args) { QuorumPeerMain main = new QuorumPeerMain(); try { main.initializeAndRun(args); } catch (IllegalArgumentException e) { LOG.fatal("Invalid arguments, exiting abnormally", e); LOG.info(USAGE); System.err.println(USAGE); System.exit(2); } catch (ConfigException e) { LOG.fatal("Invalid config, exiting abnormally", e); System.err.println("Invalid config, exiting abnormally"); System.exit(2); } catch (Exception e) { LOG.fatal("Unexpected exception, exiting abnormally", e); System.exit(1); } LOG.info("Exiting normally"); System.exit(0); }
protected void initializeAndRun(String[] args) throws ConfigException, IOException { QuorumPeerConfig config = new QuorumPeerConfig(); if (args.length == 1) { config.parse(args[0]); } if (args.length == 1 && config.servers.size() > 0) { runFromConfig(config); } else { LOG.warn("Either no config or no quorum defined in config, running " + " in standalone mode"); // there is only server in the quorum -- run as standalone ZooKeeperServerMain.main(args); } }
public static void main(String[] args) { org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger.getRootLogger(); rootLogger.setLevel(Level.INFO); // Define log pattern layout PatternLayout layout = new PatternLayout("%d{yyyy-MM-dd hh:mm:ss}:%p %t %c{n} - %m%n"); // Add console appender to root logger rootLogger.addAppender(new ConsoleAppender(layout)); QuorumPeerMain.main(args); } }
private static void runZKServer(QuorumPeerConfig zkConfig) throws UnknownHostException, IOException { 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); } }