OS版本:Centos 7.8
Hadoop版本:Hadoop 2.7.7
Hbase版本:hbase 1.4.13
Hadoop与Hbase版本对应关系:
一、Hadoop安装
参考
https://www.cnblogs.com/linwenhai/p/14611168.html
二、Hbase安装
cd /opt wget https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/1.4.13/hbase-1.4.13-bin.tar.gz tar -zxvf hbase-1.4.13-bin.tar.gz ln -s hbase-1.4.13 hbase
2.1 配置hbase-site.xml
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://test:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>test</value> </property> </configuration>
2.2 配置hbase-env.sh
# 设置使用hbase自带ZK export JAVA_HOME=/opt/jdk export HBASE_MANAGES_ZK=true
2.3 创建相关目录
/opt/hadoop/bin/hadoop fs -mkdir /hbase mkdir -p /opt/hbase/zookeeper
三、启动
bin/start-hbase.sh jps ------------------------------------------ 2176 NodeManager 3170 Jps 1909 SecondaryNameNode 1607 NameNode 2731 HMaster 1740 Datanode 2060 ResourceManager 2670 HQuorumPeer 2815 HRegionServer
浏览器访问:http://192.168.100.11:16010/
四、测试
bin/hbase shell hbase(main):018:0> exit # 查看所有表 hbase(main):001:0> list # 创建表t1,列族为f1 hbase(main):002:0> create 't1',{NAME => 'f1'} # 描述表信息 hbase(main):004:0> describe 't1' # 测试写入数据 hbase(main):005:0> create 'test','c1','c2' hbase(main):005:0> put 'test','r1','c1:1','11' put 'test','r1','c1:2','12' put 'test','r1','c1:3','13' put 'test','r1','c2:1','21' put 'test','r1','c2:2','22' put 'test','r2','c1:1','31' put 'test','r2','c1:2','32'
hbase(main):014:0> scan 'test' hbase(main):015:0> get 'test','r1',{COLUMN => 'c2:2'} hbase(main):016:0> disable 'test' hbase(main):017:0> drop 'test'
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。