zoukankan      html  css  js  c++  java
  • 27-hadoop-hbase安装

    hbase的安装分为单机模式和完全分布式

    单机模式

    单机模式的安装很简单, 需要注意hbase自己内置一个zookeeper, 如果使用单机模式, 那么该机器的zookeepr不可以启动

    1, 添加java的环境变量  vim {HBASE_HOME}/conf/hbase-env.sh

    export JAVA_HOME=/usr/opt/jdk1.7.0_79

    2, 修改配置文件  {HBASE_HOME}/conf/hbase-site.xml

    <property>
    <name>hbase.rootdir</name>
    <value>file:////data/hbase</value>
    </property>
    <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/opt/data/zkData</value>
    </property>

    3, 启动

    ./bin/start-hbase.sh

    4, 链接

    ./bin/hbase shell

    5, 查看命令

    help

    6, 查看表

    list

    ok, 单机模式搭建完成

    集群模式

    前提: zookeeper集群正常启动, hadoop集群正常启动

    1, ./conf/hbase-site.xml

    <configuration>
      <!-- 指定hdfs的存放目录--> <property> <name>hbase.rootdir</name> <value>hdfs://hdfscluster/hbase</value> </property>
    <!--开启集群模式--> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property>
    <!-- 指定zookeeper--> <property> <name>hbase.zookeeper.quorum</name> <value>192.168.208.106,192.168.208.107,192.168.208.108</value> </property> </configuration>

    其中, root.dir是在{HADOOP_HOME}/etc/hadoop/core-site.xml 中

    2, ./conf/regionserver中, 配置2台从, 即regionserver

    192.168.208.106
    192.168.208.107
    192.168.208.108

    可选配置: 在 backup-mater中配置高可用 ( 我没配置)

    192.168.208.107
    192.168.208.108

    3, hdoop.conf.dir 配置在 hbase-env.sh中 的hbase_classpath下

    有3种配置方式, 我们选第一种

    1. Add a pointer to your HADOOP_CONF_DIR to the HBASE_CLASSPATH environment variable in hbase-env.sh.

    2. Add a copy of hdfs-site.xml (or hadoop-site.xml) or, better, symlinks, under ${HBASE_HOME}/conf, or

    3. if only a small set of HDFS client configurations, add them to hbase-site.xml.

     最终 hbae-env.sh的需要配置: 

    export JAVA_HOME=/usr/opt/jdk1.7.0_79
    export HBASE_CLASSPATH=/usr/opt/hadoop-2.5.1/etc/hadoop/
    export HBASE_MANAGES_ZK=false    # 设置内置zookeeper不可用

    4, 分发到从机

    scp -r hbase-1.1.3/ root@192.168.208.107:/opt
    scp -r hbase-1.1.3/ root@192.168.208.108:/opt

    5, 需要的话配置环境变量

    6, 启动: 

    ./bin/start-hbase.sh

    7, 链接

    hbase shell

    或者访问: 192.168.208.106:16010

     

    8, 杀掉hbase

    使用命令 stop-hbase.sh, 然后等待杀死即可, 如果杀不死, 需要到zookeeper下删除 hbase节点下的元素据信息, 如果仍然杀不死, 需要删除数据信息

    集群模式需要开放的端口, 粘贴一段官网文档的原话: ( http://hbase.apache.org/book.html#_introduction

    Each HMaster uses three ports (16010, 16020, and 16030 by default). The port offset is added to these ports, so using an offset of 2, the backup HMaster would use ports 16012, 16022, and 16032. The following command starts 3 backup servers using ports 16012/16022/16032, 16013/16023/16033, and 16015/16025/16035. 

    Each RegionServer requires two ports, and the default ports are 16020 and 16030. 

    The following command starts four additional RegionServers, running on sequential ports starting at 16202/16302 (base ports 16200/16300 plus 2).

    几个简单的shell命令: 

    创建命名空间: 多个表壳属于一个命名空间

    create namespace 'namespce'

    创建

    create 'table','cf1','cf2', Version=2 # 保存2个版本
    create 'namespace:table' # 在命名空间下创建表

    查看表结构

    desc 'table'

    表删除

    disable 'table'
    drop 'table'

    查看表数据

    scan 'table' # 全表扫描 

    系类来自尚学堂极限班视频

  • 相关阅读:
    AutomationQA.com开始连载 TIB工作室核心成员 刘毅 的《软件测试自动化的探索与管理》专栏文章
    自动化测试项目实战训练【广州 5月、6月】
    大话“自动化测试框架思想与构建”
    ST&QA 2011年12期的杂志 已上传到AutomationQA资源共享
    整体思考自动化测试发展和价值回报
    热烈祝贺AutomationQA成为QA联盟核心会员!
    TestPartner中使用Module和Shared Module设计模块化结构的脚本
    [转] 自动化测试案例设计及读后感
    北京自动化测试实战训练课程下周开始
    后Web2.0的创新模式
  • 原文地址:https://www.cnblogs.com/wenbronk/p/7397860.html
Copyright © 2011-2022 走看看