Package com.activequant.server

Source Code of com.activequant.server.LocalHBaseCluster

package com.activequant.server;

import java.io.File;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;

public class LocalHBaseCluster {

    private String hostName = "localhost";
    private int port = 2181;
    private String dataDir= "./";
    public void start() throws Exception {
        Configuration config = HBaseConfiguration.create();
        // have to set a data directory.
        config.set(HConstants.ZOOKEEPER_QUORUM, hostName);
        config.set(HConstants.HBASE_DIR, dataDir);       
        //
        MiniZooKeeperCluster mzk = new MiniZooKeeperCluster(config);
        mzk.setClientPort(port);
        mzk.startup(new File("."+File.separator));
       
        HMaster master = new HMaster(config);
        master.start();
       
        HRegionServer hrs = new HRegionServer(config);
        HRegionServer.startRegionServer(hrs);
    }
   
}
TOP

Related Classes of com.activequant.server.LocalHBaseCluster

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.