Examples of QuorumPeerConfig


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

        .getHostAddress());
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("starting zookeeper server on {}:{}",
          p.get("clientPortAddress"), p.get("clientPort"));
    }
    QuorumPeerConfig qpc = new QuorumPeerConfig();
    qpc.parseProperties(p);
    config = new ServerConfig();
    config.readFrom(qpc);
    zkThread = new Thread(this);
    zkThread.start();
  }
View Full Code Here

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

    assertEquals(Integer.valueOf(2181),
      Integer.valueOf(properties.getProperty("clientPort")));
    assertEquals("localhost:2888:3888", properties.get("server.0"));

    HQuorumPeer.writeMyID(properties);
    QuorumPeerConfig config = new QuorumPeerConfig();
    config.parseProperties(properties);

    assertEquals(this.dataDir.toString(), config.getDataDir());
    assertEquals(2181, config.getClientPortAddress().getPort());
    Map<Long,QuorumServer> servers = config.getServers();
    assertEquals(3, servers.size());
    assertTrue(servers.containsKey(Long.valueOf(0)));
    QuorumServer server = servers.get(Long.valueOf(0));
    assertEquals("localhost", server.addr.getHostName());

    // Override with system property.
    System.setProperty("hbase.master.hostname", "foo.bar");
    is = new ByteArrayInputStream(s.getBytes());
    properties = ZKConfig.parseZooCfg(conf, is);
    assertEquals("foo.bar:2888:3888", properties.get("server.0"));

    config.parseProperties(properties);

    servers = config.getServers();
    server = servers.get(Long.valueOf(0));
    assertEquals("foo.bar", server.addr.getHostName());
  }
View Full Code Here

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

        {
            public void run()
            {
                try
                {
                    QuorumPeerConfig config = configBuilder.buildConfig(thisInstanceIndex);
                    main.runFromConfig(config);
                }
                catch ( Exception e )
                {
                    logger.error(String.format("From testing server (random state: %s) for instance: %s", String.valueOf(configBuilder.isFromRandom()), getInstanceSpec()), e);
View Full Code Here

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

     * @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

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

      @Override
      public void run() {
        try {
          // Configure a local zookeeper instance
          Properties zkProperties = generateLocalZkProperties();
          QuorumPeerConfig qpConfig = new QuorumPeerConfig();
          qpConfig.parseProperties(zkProperties);
          // run the zookeeper instance
          final ServerConfig zkConfig = new ServerConfig();
          zkConfig.readFrom(qpConfig);
          zookeeper.runFromConfig(zkConfig);
        } catch (QuorumPeerConfig.ConfigException qpcce) {
View Full Code Here

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

        new Path(outputDir.toString()));

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

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

    boolean success = runZooKeeperAndJob(qpConfig, job);
    if (!success) {
      return null;
    }
View Full Code Here

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

    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

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

            + 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

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

    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

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

            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
TOP
Copyright © 2018 www.massapi.com. 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.