zoukankan      html  css  js  c++  java
  • HBase完全分布模式安装

    假设Hadoop已经成功安装。

    实验环境如下
    centos 6.4
    hadoop-0.20.2
    hbase-0.90.5
     
     
     
    用户名root
    hadoop安装目录:/root/bin/hadoop-0.20.2
    hbase计划安装目录:/root/bin/hbase-0.90.5
     
    大致过程为:首先在masternode上安装hbase,配置好后再拷贝至slave机器。
    (1)下载hbase-0.90.5.tar.gz,解压到/root/bin/hbase-0.90.5
    (2)编辑/root/bin/hbase-0.90.5/conf/hbase-env.sh,编辑后如下所示,带颜色的部分为修改部分:
    #
    #
     
    # Set environment variables here.
     
    # The java implementation to use.  Java 1.6 required. Java安装目录,最低1.6版本
    export JAVA_HOME=/root/bin/jdk1.6.0_26
     
    # Extra Java CLASSPATH elements.  Optional. 整合hadoop的配置文件
    export HBASE_CLASSPATH=/root/bin/hadoop-0.20.2/conf
     
    # The maximum amount of heap to use, in MB. Default is 1000.
    # export HBASE_HEAPSIZE=1000
     
    # Extra Java runtime options.
    # Below are what we set by default.  May only work with SUN JVM.
    # For more on why as well as other possible settings,
    # see http://wiki.apache.org/hadoop/PerformanceTuning
    export HBASE_OPTS="-ea -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode"
     
    # Uncomment below to enable java garbage collection logging in the .out file.
    # export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps" 
     
    # Uncomment and adjust to enable JMX exporting
    # See jmxremote.password and jmxremote.access in $JRE_HOME/lib/management to configure remote password access.
    # More details at: http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
    #
    # export HBASE_JMX_BASE="-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
    # export HBASE_MASTER_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10101"
    # export HBASE_REGIONSERVER_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10102"
    # export HBASE_THRIFT_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10103"
    # export HBASE_ZOOKEEPER_OPTS="$HBASE_JMX_BASE -Dcom.sun.management.jmxremote.port=10104"
     
    # File naming hosts on which HRegionServers will run.  $HBASE_HOME/conf/regionservers by default.
    # export HBASE_REGIONSERVERS=${HBASE_HOME}/conf/regionservers
     
    # Extra ssh options.  Empty by default.
    # export HBASE_SSH_OPTS="-o ConnectTimeout=1 -o SendEnv=HBASE_CONF_DIR"
     
    # Where log files are stored.  $HBASE_HOME/logs by default.  hbase日志目录,注意logs目录需创建
    export HBASE_LOG_DIR=/root/bin/hbase-0.90.5/logs
     
    # A string representing this instance of hbase. $USER by default.
    # export HBASE_IDENT_STRING=$USER
     
    # The scheduling priority for daemon processes.  See 'man nice'.
    # export HBASE_NICENESS=10
     
    # The directory where pid files are stored. /tmp by default.
    # export HBASE_PID_DIR=/var/hadoop/pids
     
    # Seconds to sleep between slave commands.  Unset by default.  This
    # can be useful in large clusters, where, e.g., slave rsyncs can
    # otherwise arrive faster than the master can service them.
    # export HBASE_SLAVE_SLEEP=0.1
     
    # Tell HBase whether it should manage it's own instance of Zookeeper or not.开启zookeeper
    export HBASE_MANAGES_ZK=true
     
     
    (3)编辑/home/grid/hbase/conf/hbase-site.xml,默认内无属性,均需自行添加:
       
    <configuration>
            <property>
                   <name>hbase.rootdir</name>
                   <value>hdfs://master:9000/hbase</value>
            </property>
            <property>
                    <name>hbase.cluster.distributed</name>
                    <value>true</value>
            </property>
            <property>
                    <name>hbase.master</name>
                    <value>master:60000</value>
            </property>
            <property>
                     <name>hbase.zookeeper.quorum</name>
                     <value>master,slave1,slave2</value>
             </property>
    </configuration>
    View Code
    (4)编辑/root/bin/conf/regionservers,将所有的slavenode添加到这个文件,类似与hadoop中slaves文件,该文件原本为空,如下是我添加的内容,两台slavenode机器的域名(hosts文件中已做解析):
    slave1
    slave2
    (5)解决版本、jar包冲突:
     
     
    (5)将master节点上已经配置好的hbase文件夹拷贝到slave节点,执行:
     
    (6)启动
    1)启动hadoop:/root/bin/hadoop-0.20.2/bin/start-all.sh
    执行命令后用jps命令验证,显示:
     
    3549 Jps
    2438 NameNode
    2758 JobTracker
    2690 SecondaryNameNode
     
    说明hadoop启动成功。
    2)启动hbase:/root/bin/hbase/bin/start-hbase.sh
    执行命令后用jps命令验证,显示:
     
    3750 Jps
    3652 HMaster
    2438 NameNode
    2758 JobTracker
    2690 SecondaryNameNode
     
    说明hbase启动成功,然后分别到两台slave机器上执行jps,slave1上执行jps,显示:
     
    2676 TaskTracker
    2504 DataNode
    3800 Jps
    3501 HQuorumPeer
    3669 HRegionServer
     
    注意其中HQuorumPeer是zookeeper进程,在hbase-site.xml中的hbase.zookeeper.quorum属性中为slavenode1配置了zookeeper;
    slavenode2上执行jps,显示:
     
    2663 TaskTracker
    2482 DataNode
    3607 Jps
    3530 HRegionServer
     
    (8)进入hbase
    在master机器执行hbase/bin/hbase shell即可进入hbase的shell
     
    grid@masternode:~$ hbase/bin/hbase shell
    HBase Shell; enter 'help' for list of supported commands.
    Type "exit" to leave the HBase Shell
    Version 0.90.5, r1212209, Fri Dec  9 05:40:36 UTC 2011
     
    hbase(main):001:0>
  • 相关阅读:
    Centos 7 zabbix 实战应用
    Centos7 Zabbix添加主机、图形、触发器
    Centos7 Zabbix监控部署
    Centos7 Ntp 时间服务器
    Linux 150命令之查看文件及内容处理命令 cat tac less head tail cut
    Kickstart 安装centos7
    Centos7与Centos6的区别
    Linux 150命令之 文件和目录操作命令 chattr lsattr find
    Linux 发展史与vm安装linux centos 6.9
    Linux介绍
  • 原文地址:https://www.cnblogs.com/hbase/p/3638568.html
Copyright © 2011-2022 走看看