Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.LocalHBaseCluster


        conf.set(HConstants.ZOOKEEPER_CLIENT_PORT,
                 Integer.toString(clientPort));
        conf.setInt(HConstants.ZK_SESSION_TIMEOUT, 10 *1000);
        // Need to have the zk cluster shutdown when master is shutdown.
        // Run a subclass that does the zk cluster shutdown on its way out.
        LocalHBaseCluster cluster = new LocalHBaseCluster(conf, conf.getInt("hbase.masters", 1),
          conf.getInt("hbase.regionservers", 0), LocalHMaster.class, HRegionServer.class);
        ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
        cluster.startup();
        waitOnMasterThreads(cluster);
      } else {
        logProcessInfo(getConf());
        CoordinatedStateManager csm =
          CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
View Full Code Here


    // Start the cluster
    final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
    TEST_UTIL.startMiniDFSCluster(3);
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.createRootDir();
    final LocalHBaseCluster cluster =
        new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class, MockedRegionServer.class);
    final MasterThread master = cluster.getMasters().get(0);
    master.start();
    try {
      long startTime = System.currentTimeMillis();
      while (!master.getMaster().isActiveMaster()) {
        try {
          Thread.sleep(100);
        } catch (InterruptedException ignored) {
        }
        if (System.currentTimeMillis() > startTime + 30000) {
          throw new RuntimeException("Master not active after 30 seconds");
        }
      }
      masterActive = true;
      cluster.getRegionServers().get(0).start();
      cluster.getRegionServers().get(1).start();
      Thread.sleep(10000);
      List<ServerName> onlineServersList =
          master.getMaster().getServerManager().getOnlineServersList();
      while (onlineServersList.size() > 2) {
        Thread.sleep(100);
        onlineServersList = master.getMaster().getServerManager().getOnlineServersList();
      }
      assertEquals(onlineServersList.size(), 2);
      cluster.shutdown();
    } finally {
      masterActive = false;
      firstRS.set(true);
      TEST_UTIL.shutdownMiniCluster();
    }
View Full Code Here

    // Start the cluster
    final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
    TEST_UTIL.startMiniDFSCluster(3);
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.createRootDir();
    final LocalHBaseCluster cluster =
        new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
            MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
    final MasterThread master = cluster.getMasters().get(0);
    master.start();
    Thread shutdownThread = new Thread() {
      public void run() {
        try {
          TEST_UTIL.getHBaseAdmin().shutdown();
          cluster.waitOnMaster(0);
        } catch (Exception e) {
        }
      };
    };
    shutdownThread.start();
    master.join();
    shutdownThread.join();

    List<MasterThread> masterThreads = cluster.getMasters();
    // make sure all the masters properly shutdown
    assertEquals(0, masterThreads.size());

    TEST_UTIL.shutdownMiniZKCluster();
    TEST_UTIL.shutdownMiniDFSCluster();
View Full Code Here

        }
        conf.set("hbase.zookeeper.property.clientPort",
                 Integer.toString(clientPort));
        // Need to have the zk cluster shutdown when master is shutdown.
        // Run a subclass that does the zk cluster shutdown on its way out.
        LocalHBaseCluster cluster = new LocalHBaseCluster(conf, 1, 1,
                                                          LocalHMaster.class, HRegionServer.class);
        ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
        cluster.startup();
      } else {
        HMaster master = HMaster.constructMaster(masterClass, conf);
        if (master.isStopped()) {
          LOG.info("Won't bring the Master up as a shutdown is requested");
          return -1;
View Full Code Here

        }
        conf.set(HConstants.ZOOKEEPER_CLIENT_PORT,
                 Integer.toString(clientPort));
        // Need to have the zk cluster shutdown when master is shutdown.
        // Run a subclass that does the zk cluster shutdown on its way out.
        LocalHBaseCluster cluster = new LocalHBaseCluster(conf, conf.getInt("hbase.masters", 1),
          conf.getInt("hbase.regionservers", 1), LocalHMaster.class, HRegionServer.class);
        ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
        cluster.startup();
        waitOnMasterThreads(cluster);
      } else {
        logProcessInfo(getConf());
        HMaster master = HMaster.constructMaster(masterClass, conf);
        if (master.isStopped()) {
View Full Code Here

        }
        conf.set(HConstants.ZOOKEEPER_CLIENT_PORT,
                 Integer.toString(clientPort));
        // Need to have the zk cluster shutdown when master is shutdown.
        // Run a subclass that does the zk cluster shutdown on its way out.
        LocalHBaseCluster cluster = new LocalHBaseCluster(conf, 1, 1,
                                                          LocalHMaster.class, HRegionServer.class);
        ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
        cluster.startup();
        waitOnMasterThreads(cluster);
      } else {
        HMaster master = HMaster.constructMaster(masterClass, conf);
        if (master.isStopped()) {
          LOG.info("Won't bring the Master up as a shutdown is requested");
View Full Code Here

              runtime.getVmVendor() + ", vmVersion=" + runtime.getVmVersion());
            LOG.info("vmInputArguments=" + runtime.getInputArguments());
          }
          // If 'local', defer to LocalHBaseCluster instance.
          if (LocalHBaseCluster.isLocal(conf)) {
            (new LocalHBaseCluster(conf)).startup();
          } else {
            Constructor<? extends HMaster> c =
              masterClass.getConstructor(HBaseConfiguration.class);
            HMaster master = c.newInstance(conf);
            master.start();
View Full Code Here

    // Start the cluster
    final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
    TEST_UTIL.startMiniDFSCluster(3);
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.createRootDir();
    final LocalHBaseCluster cluster =
        new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
            MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
    final MasterThread master = cluster.getMasters().get(0);
    master.start();
    Thread shutdownThread = new Thread() {
      public void run() {
        try {
          TEST_UTIL.getHBaseAdmin().shutdown();
          cluster.waitOnMaster(0);
        } catch (Exception e) {
        }
      };
    };
    shutdownThread.start();
    master.join();
    shutdownThread.join();

    List<MasterThread> masterThreads = cluster.getMasters();
    // make sure all the masters properly shutdown
    assertEquals(0, masterThreads.size());

    TEST_UTIL.shutdownMiniZKCluster();
    TEST_UTIL.shutdownMiniDFSCluster();
View Full Code Here

    // Start the cluster
    final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(conf);
    TEST_UTIL.startMiniDFSCluster(3);
    TEST_UTIL.startMiniZKCluster();
    TEST_UTIL.createRootDir();
    final LocalHBaseCluster cluster =
        new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class, MockedRegionServer.class);
    final MasterThread master = cluster.getMasters().get(0);
    master.start();
    try {
      long startTime = System.currentTimeMillis();
      while (!master.getMaster().isInitialized()) {
        try {
          Thread.sleep(100);
        } catch (InterruptedException ignored) {
        }
        if (System.currentTimeMillis() > startTime + 30000) {
          throw new RuntimeException("Master not active after 30 seconds");
        }
      }
      masterActive = true;
      cluster.getRegionServers().get(0).start();
      cluster.getRegionServers().get(1).start();
      Thread.sleep(10000);
      List<ServerName> onlineServersList =
          master.getMaster().getServerManager().getOnlineServersList();
      while (onlineServersList.size() > 2) {
        Thread.sleep(100);
        onlineServersList = master.getMaster().getServerManager().getOnlineServersList();
      }
      assertEquals(onlineServersList.size(), 2);
      cluster.shutdown();
    } finally {
      masterActive = false;
      firstRS.set(true);
      TEST_UTIL.shutdownMiniCluster();
    }
View Full Code Here

        // Run a subclass that does the zk cluster shutdown on its way out.
        int mastersCount = conf.getInt("hbase.masters", 1);
        int regionServersCount = conf.getInt("hbase.regionservers", 1);
        LOG.info("Starting up instance of localHBaseCluster; master=" + mastersCount +
          ", regionserversCount=" + regionServersCount);
        LocalHBaseCluster cluster = new LocalHBaseCluster(conf, mastersCount, regionServersCount,
          LocalHMaster.class, HRegionServer.class);
        ((LocalHMaster)cluster.getMaster(0)).setZKCluster(zooKeeperCluster);
        cluster.startup();
        waitOnMasterThreads(cluster);
      } else {
        logProcessInfo(getConf());
        CoordinatedStateManager csm =
          CoordinatedStateManagerFactory.getCoordinatedStateManager(conf);
View Full Code Here

TOP

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

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.