Package org.apache.zookeeper.server.quorum

Examples of org.apache.zookeeper.server.quorum.QuorumPeerConfig


    public static void stopServer() throws Exception {
        simpleServer.stop();
    }

    private static QuorumPeerConfig getPeerConfig(Properties props) throws IOException, QuorumPeerConfig.ConfigException {
        QuorumPeerConfig peerConfig = new QuorumPeerConfig();
        peerConfig.parseProperties(props);
        LOGGER.info("Created zookeeper peer configuration: {}", peerConfig);
        return peerConfig;
    }
View Full Code Here


    Properties properties = new Properties();
    properties.setProperty("dataDir", dataDir.toAbsolutePath().toString());
    properties.setProperty("clientPort", Integer.toString(port));
    log.info("ZK config: {}" , properties);

    QuorumPeerConfig quorumConfig = new QuorumPeerConfig();
    try {
      quorumConfig.parseProperties(properties);
    } catch (QuorumPeerConfig.ConfigException e) {
      throw new IllegalArgumentException(e);
    }

    purgeManager =
        new DatadirCleanupManager(quorumConfig.getDataDir(),
                                  quorumConfig.getDataLogDir(),
                                  quorumConfig.getSnapRetainCount(),
                                  quorumConfig.getPurgeInterval());
    purgeManager.start();

    ServerConfig serverConfig = new ServerConfig();
    serverConfig.readFrom(quorumConfig);
View Full Code Here

    } else if (this.quorumPeer != null && !this.quorumPeer.isAlive()) {
      this.quorumPeer.start();
      return;
    }
    try {
      final QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
      quorumPeerConfig.parse(conf.getConfFile());
      QuorumPeer.Factory qpFactory = new QuorumPeer.Factory() {
        public QuorumPeer create(NIOServerCnxn.Factory cnxnFactory) throws IOException {
          ServerConfig serverConfig = new ServerConfig();
          serverConfig.readFrom(quorumPeerConfig);
          QuorumPeer peer = new QuorumPeer(quorumPeerConfig.getServers(), new File(serverConfig.getDataDir()), new File(
              serverConfig.getDataLogDir()), quorumPeerConfig.getElectionAlg(), quorumPeerConfig.getServerId(),
              quorumPeerConfig.getTickTime(), quorumPeerConfig.getInitLimit(), quorumPeerConfig.getSyncLimit(), cnxnFactory,
              quorumPeerConfig.getQuorumVerifier());
          ZooDiscoveryContainer.this.quorumPeer = peer;
          return peer;
        }

        public NIOServerCnxn.Factory createConnectionFactory() throws IOException {
          return new NIOServerCnxn.Factory(quorumPeerConfig.getClientPortAddress());
        }
      };
      quorumPeer = qpFactory.create(qpFactory.createConnectionFactory());
      quorumPeer.start();
      quorumPeer.setDaemon(true);
View Full Code Here

     * @param path the patch of the configuration file
     * @return ServerConfig configured wrt arguments
     * @throws ConfigException error processing configuration
     */
    public void parse(String path) throws ConfigException {
        QuorumPeerConfig config = new QuorumPeerConfig();
        config.parse(path);

        // let qpconfig parse the file and then pull the stuff we are
        // interested in
        readFrom(config);
    }
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.server.quorum.QuorumPeerConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.