Package org.apache.zookeeper.server.quorum

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


    GiraphConstants.CHECKPOINT_DIRECTORY.set(conf, checkpointsDir);

    // Configure a local zookeeper instance
    Properties zkProperties = configLocalZooKeeper(zkDir, localZookeeperPort);

    QuorumPeerConfig qpConfig = new QuorumPeerConfig();
    qpConfig.parseProperties(zkProperties);

    runZooKeeperAndJob(qpConfig, job);

  }
View Full Code Here


            + File.separator + UUID.randomUUID());
        file.deleteOnExit();
        properties.setProperty("dataDir", file.getAbsolutePath());
        properties.setProperty("clientPort", String.valueOf(clientPort));

        QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig();
        quorumPeerConfig.parseProperties(properties);

        zkServer = new ZooKeeperServerMain();
        ServerConfig configuration = new ServerConfig();
        configuration.readFrom(quorumPeerConfig);
View Full Code Here

    Properties properties = new Properties();
    properties.setProperty("tickTime", tickTime.toString());
    properties.setProperty("clientPort", clientPort.toString());
    properties.setProperty("dataDir", this.dataDir.getAbsolutePath());

    QuorumPeerConfig qpc = new QuorumPeerConfig();
    try {
      qpc.parseProperties(properties);
    } catch (IOException e) {
      throw new RuntimeException("This is impossible - no I/O to configure a quorumpeer from a properties object", e);
    }

    // don't ask me why ...
View Full Code Here

            destroyable = null;
        }
    }

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

    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$ConfigException

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.