Search in sources :

Example 1 with LoadBalancerTracker

use of org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker in project hbase by apache.

the class HMaster method initializeZKBasedSystemTrackers.

/**
   * Initialize all ZK based system trackers.
   */
void initializeZKBasedSystemTrackers() throws IOException, InterruptedException, KeeperException, CoordinatedStateException {
    this.balancer = LoadBalancerFactory.getLoadBalancer(conf);
    this.normalizer = RegionNormalizerFactory.getRegionNormalizer(conf);
    this.normalizer.setMasterServices(this);
    this.normalizer.setMasterRpcServices((MasterRpcServices) rpcServices);
    this.loadBalancerTracker = new LoadBalancerTracker(zooKeeper, this);
    this.loadBalancerTracker.start();
    this.regionNormalizerTracker = new RegionNormalizerTracker(zooKeeper, this);
    this.regionNormalizerTracker.start();
    this.splitOrMergeTracker = new SplitOrMergeTracker(zooKeeper, conf, this);
    this.splitOrMergeTracker.start();
    this.assignmentManager = new AssignmentManager(this, serverManager, this.balancer, this.service, this.metricsMaster, tableStateManager);
    this.replicationManager = new ReplicationManager(conf, zooKeeper, this);
    this.regionServerTracker = new RegionServerTracker(zooKeeper, this, this.serverManager);
    this.regionServerTracker.start();
    this.drainingServerTracker = new DrainingServerTracker(zooKeeper, this, this.serverManager);
    this.drainingServerTracker.start();
    this.maintenanceModeTracker = new MasterMaintenanceModeTracker(zooKeeper);
    this.maintenanceModeTracker.start();
    // Set the cluster as up.  If new RSs, they'll be waiting on this before
    // going ahead with their startup.
    boolean wasUp = this.clusterStatusTracker.isClusterUp();
    if (!wasUp)
        this.clusterStatusTracker.setClusterUp();
    LOG.info("Server active/primary master=" + this.serverName + ", sessionid=0x" + Long.toHexString(this.zooKeeper.getRecoverableZooKeeper().getSessionId()) + ", setting cluster-up flag (Was=" + wasUp + ")");
    // create/initialize the snapshot manager and other procedure managers
    this.snapshotManager = new SnapshotManager();
    this.mpmHost = new MasterProcedureManagerHost();
    this.mpmHost.register(this.snapshotManager);
    this.mpmHost.register(new MasterFlushTableProcedureManager());
    this.mpmHost.loadProcedures(conf);
    this.mpmHost.initialize(this, this.metricsMaster);
}
Also used : MasterFlushTableProcedureManager(org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager) ReplicationManager(org.apache.hadoop.hbase.master.replication.ReplicationManager) MasterProcedureManagerHost(org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost) LoadBalancerTracker(org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker) DrainingServerTracker(org.apache.hadoop.hbase.zookeeper.DrainingServerTracker) RegionNormalizerTracker(org.apache.hadoop.hbase.zookeeper.RegionNormalizerTracker) SplitOrMergeTracker(org.apache.hadoop.hbase.zookeeper.SplitOrMergeTracker) MasterMaintenanceModeTracker(org.apache.hadoop.hbase.zookeeper.MasterMaintenanceModeTracker) RegionServerTracker(org.apache.hadoop.hbase.zookeeper.RegionServerTracker) SnapshotManager(org.apache.hadoop.hbase.master.snapshot.SnapshotManager)

Example 2 with LoadBalancerTracker

use of org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker in project hbase by apache.

the class TestMetaWithReplicas method setup.

@Before
public void setup() throws Exception {
    TEST_UTIL.getConfiguration().setInt("zookeeper.session.timeout", 30000);
    TEST_UTIL.getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 3);
    TEST_UTIL.getConfiguration().setInt(StorefileRefresherChore.REGIONSERVER_STOREFILE_REFRESH_PERIOD, 1000);
    TEST_UTIL.startMiniCluster(3);
    // disable the balancer
    LoadBalancerTracker l = new LoadBalancerTracker(TEST_UTIL.getZooKeeperWatcher(), new Abortable() {

        boolean aborted = false;

        @Override
        public boolean isAborted() {
            return aborted;
        }

        @Override
        public void abort(String why, Throwable e) {
            aborted = true;
        }
    });
    l.setBalancerOn(false);
    for (int replicaId = 1; replicaId < 3; replicaId++) {
        HRegionInfo h = RegionReplicaUtil.getRegionInfoForReplica(HRegionInfo.FIRST_META_REGIONINFO, replicaId);
        TEST_UTIL.getMiniHBaseCluster().getMaster().getAssignmentManager().waitForAssignment(h);
    }
    LOG.debug("All meta replicas assigned");
}
Also used : HRegionInfo(org.apache.hadoop.hbase.HRegionInfo) LoadBalancerTracker(org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker) Abortable(org.apache.hadoop.hbase.Abortable) Before(org.junit.Before)

Aggregations

LoadBalancerTracker (org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker)2 Abortable (org.apache.hadoop.hbase.Abortable)1 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)1 ReplicationManager (org.apache.hadoop.hbase.master.replication.ReplicationManager)1 SnapshotManager (org.apache.hadoop.hbase.master.snapshot.SnapshotManager)1 MasterProcedureManagerHost (org.apache.hadoop.hbase.procedure.MasterProcedureManagerHost)1 MasterFlushTableProcedureManager (org.apache.hadoop.hbase.procedure.flush.MasterFlushTableProcedureManager)1 DrainingServerTracker (org.apache.hadoop.hbase.zookeeper.DrainingServerTracker)1 MasterMaintenanceModeTracker (org.apache.hadoop.hbase.zookeeper.MasterMaintenanceModeTracker)1 RegionNormalizerTracker (org.apache.hadoop.hbase.zookeeper.RegionNormalizerTracker)1 RegionServerTracker (org.apache.hadoop.hbase.zookeeper.RegionServerTracker)1 SplitOrMergeTracker (org.apache.hadoop.hbase.zookeeper.SplitOrMergeTracker)1 Before (org.junit.Before)1