Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.MasterAddressTracker


        if (clusterId.hasId()) {
          conf.set(HConstants.CLUSTER_ID, clusterId.getId());
        }
      }
      if (masterAddressTracker == null) {
        masterAddressTracker = new MasterAddressTracker(zooKeeper, this);
        masterAddressTracker.start();
      }
      if (rootRegionTracker == null) {
        rootRegionTracker = new RootRegionTracker(zooKeeper, this);
        rootRegionTracker.start();
View Full Code Here


      serverInfo.getServerAddress().getPort(), this);

    // Create the master address manager, register with zk, and start it.  Then
    // block until a master is available.  No point in starting up if no master
    // running.
    this.masterAddressManager = new MasterAddressTracker(this.zooKeeper, this);
    this.masterAddressManager.start();
    blockAndCheckIfStopped(this.masterAddressManager);

    // Wait on cluster being up.  Master will set this flag up in zookeeper
    // when ready.
View Full Code Here

    private synchronized void setupZookeeperTrackers()
        throws ZooKeeperConnectionException{
      // initialize zookeeper and master address manager
      this.zooKeeper = getZooKeeperWatcher();
      masterAddressTracker = new MasterAddressTracker(this.zooKeeper, this);
      zooKeeper.registerListener(masterAddressTracker);
      masterAddressTracker.start();

      this.rootRegionTracker = new RootRegionTracker(this.zooKeeper, this);
      this.rootRegionTracker.start();
View Full Code Here

    ZooKeeperWatcher zk = new ZooKeeperWatcher(TEST_UTIL.getConfiguration(),
        "testMasterAddressManagerFromZK", null);
    ZKUtil.createAndFailSilent(zk, zk.baseZNode);

    // Should not have a master yet
    MasterAddressTracker addressManager = new MasterAddressTracker(zk, null);
    addressManager.start();
    assertFalse(addressManager.hasMaster());
    zk.registerListener(addressManager);

    // Use a listener to capture when the node is actually created
    NodeCreationListener listener = new NodeCreationListener(zk, zk.masterAddressZNode);
    zk.registerListener(listener);

    // Create the master node with a dummy address
    String host = "localhost";
    int port = 1234;
    HServerAddress dummyAddress = new HServerAddress(host, port);
    LOG.info("Creating master node");
    ZKUtil.setAddressAndWatch(zk, zk.masterAddressZNode, dummyAddress);

    // Wait for the node to be created
    LOG.info("Waiting for master address manager to be notified");
    listener.waitForCreation();
    LOG.info("Master node created");
    assertTrue(addressManager.hasMaster());
    HServerAddress pulledAddress = addressManager.getMasterAddress();
    assertTrue(pulledAddress.equals(dummyAddress));

  }
View Full Code Here

      serverInfo.getServerAddress().getPort(), this);

    // Create the master address manager, register with zk, and start it.  Then
    // block until a master is available.  No point in starting up if no master
    // running.
    this.masterAddressManager = new MasterAddressTracker(this.zooKeeper, this);
    this.masterAddressManager.start();
    blockAndCheckIfStopped(this.masterAddressManager);

    // Wait on cluster being up.  Master will set this flag up in zookeeper
    // when ready.
View Full Code Here

    private synchronized void setupZookeeperTrackers()
        throws ZooKeeperConnectionException{
      // initialize zookeeper and master address manager
      this.zooKeeper = getZooKeeperWatcher();
      masterAddressTracker = new MasterAddressTracker(this.zooKeeper, this);
      masterAddressTracker.start();

      this.rootRegionTracker = new RootRegionTracker(this.zooKeeper, this);
      this.rootRegionTracker.start();
    }
View Full Code Here

      this.isa.getPort(), this);

    // Create the master address manager, register with zk, and start it.  Then
    // block until a master is available.  No point in starting up if no master
    // running.
    this.masterAddressManager = new MasterAddressTracker(this.zooKeeper, this);
    this.masterAddressManager.start();
    blockAndCheckIfStopped(this.masterAddressManager);

    // Wait on cluster being up.  Master will set this flag up in zookeeper
    // when ready.
View Full Code Here

      }
      if (clusterId == null) {
        clusterId = new ClusterId(zooKeeper, this);
      }
      if (masterAddressTracker == null) {
        masterAddressTracker = new MasterAddressTracker(zooKeeper, this);
        masterAddressTracker.start();
      }
      if (rootRegionTracker == null) {
        rootRegionTracker = new RootRegionTracker(zooKeeper, this);
        rootRegionTracker.start();
View Full Code Here

      }
      if (clusterId == null) {
        clusterId = new ClusterId(zooKeeper, this);
      }
      if (masterAddressTracker == null) {
        masterAddressTracker = new MasterAddressTracker(zooKeeper, this);
        masterAddressTracker.start();
      }
      if (rootRegionTracker == null) {
        rootRegionTracker = new RootRegionTracker(zooKeeper, this);
        rootRegionTracker.start();
View Full Code Here

    ZooKeeperWatcher zkw = Mockito.mock(ZooKeeperWatcher.class);
    Mockito.doReturn("fakequorum").when(zkw).getQuorum();
    Mockito.doReturn(zkw).when(rs).getZooKeeper();

    // Fake MasterAddressTracker
    MasterAddressTracker mat = Mockito.mock(MasterAddressTracker.class);
    Mockito.doReturn(fakeMasterAddress).when(mat).getMasterAddress();
    Mockito.doReturn(mat).when(rs).getMasterAddressManager();
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.MasterAddressTracker

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.