Linux安装hbase

(1)下载HBase安装包并解压

https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/1.2.6/hbase-1.2.6-bin.tar.gz

tar -zxvf hbase-1.2.6-bin.tar.gz

(2)进入该目录下的conf目录

向hbase-env.sh中添加:

 export JAVA_HOME=/usr/lib/jvm/java-8-oracle

 export HBASE_MANAGES_ZK=false

修改hbase-site.xml为

  1.  
    <configuration>
  2.  
    <property>
  3.  
    <name>hbase.zookeeper.quorum</name>
  4.  
    <value>pc2,pc3,pc4</value>
  5.  
    <description>The directory shared by RegionServers.
  6.  
    </description>
  7.  
    </property>
  8.  
     
  9.  
    <property>
  10.  
    <name>hbase.rootdir</name>
  11.  
    <value>hdfs://pc2:9000/hbase</value>
  12.  
    <description>The directory shared by RegionServers.
  13.  
    </description>
  14.  
    </property>
  15.  
    <property>
  16.  
    <name>hbase.cluster.distributed</name>
  17.  
    <value>true</value>
  18.  
    <description>The mode the cluster will be in. Possible values are
  19.  
    false: standalone and pseudo-distributed setups with managed Zookeeper
  20.  
    true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh)
  21.  
    </description>
  22.  
    </property>
  23.  
        <property>
  24.  
    <name>hbase.master.info.port</name>
  25.  
    <value>60010</value>
  26.  
    </property>
  27.  
    </configuration>

其中,

hbase.zookeeper.quorum为zookeeper的节点主机名

 

hbase.rootdir为hbase的存储根目录,设为hadoopHDFS根目录下的hbase

修改regionservers为(regionserver为从结点)

pc3

pc4

使用scp -r hbase-1.2.6 chenjie@pc3:/home/chenjie

scp -r hbase-1.2.6 chenjie@pc4:/home/chenjie

将pc2上配置好的hbase发送到pc3、pc4上

(3)切换到bin目录下使用./start-hbase.sh启动hbase

(4)使用hbase shell进入hbase的命令行窗口

使用命令create 'test1', {NAME=>'cf',VERSIONS=>3,COMPRESSION=>'gz'}创建一张表

分别执行

put 'test1','rowkey1','cf:q1','r1-v1'
put 'test1','rowkey1','cf:q2','r1-v2'
put 'test1','rowkey2','cf:q1','r2-v1'
put 'test1','rowkey2','cf:q2','r2-v2'
put 'test1','rowkey2','cf:q3','r2-v3'

插入四条记录

使用命令scan 'test1'查看表数据

(5)登录master的web管理界面

http://192.168.1.112:60010

posted @ 2020-09-10 10:24  小赖同学啊  阅读(346)  评论(0编辑  收藏  举报