Package org.apache.zookeeper.server.quorum

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


  public static void main(String[] args) {
    Configuration conf = HBaseConfiguration.create();
    try {
      Properties zkProperties = ZKConfig.makeZKProps(conf);
      writeMyID(zkProperties);
      QuorumPeerConfig zkConfig = new QuorumPeerConfig();
      zkConfig.parseProperties(zkProperties);
      runZKServer(zkConfig);
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(-1);
    }
View Full Code Here


    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

    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

  @Override
  public synchronized void start()
  {
    try
    {
      QuorumPeerConfig qpc = new QuorumPeerConfig();
      Properties p = new Properties();
      p.setProperty("tickTime", _tickTime);
      p.setProperty("clientPort", String.valueOf(_clientPort));
      p.setProperty("dataDir", _dataDir);
      qpc.parseProperties(p);

      ServerConfig serverConfig = new ServerConfig();
      serverConfig.readFrom(qpc);

      runFromConfig(serverConfig);
View Full Code Here

        .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

    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

        {
            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

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

      @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

        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

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.