Hadoop Hbase - 单机版

Apache HBase™ is the Hadoop database, a distributed, scalable, big data store.

Use Apache HBase™ when you need random, realtime read/write access to your Big Data. This project's goal is the hosting of very large tables -- billions of rows X millions of columns -- atop clusters of commodity hardware. Apache HBase is an open-source, distributed, versioned, non-relational database modeled after Google's Bigtable: A Distributed Storage System for Structured Data by Chang et al. Just as Bigtable leverages the distributed data storage provided by the Google File System, Apache HBase provides Bigtable-like capabilities on top of Hadoop and HDFS.

 

集群环境

Centos7 
hadoop 3.3.0
zookeeper 3.6.1
hbase  1.3.1

 

搭建zookeeper 单节点

tar -zxf apache-zookeeper-3.6.1-bin.tar.gz -C ../module/

 

修改zoo.cfg文件

vim zoo.cfg 

修改

  dataDir=/opt/module/zookeeper/zkData


追加
#######################cluster########################## server.
1=hadoop001:2888:3888

 

创建/opt/module/zookeeper/zkData 目录

写入myid文件

mkdir zkData
echo '1' > ./zkData/myid

 

启动zookeeper

./bin/zkServer.sh start

 

 

 

 

解压Hbase 文件

tar -zxf hbase-1.3.1-bin.tar.gz -C /opt/module/

 

修改hbase-site.xml

 vim hbase-site.xml

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://hadoop001:9000/HBase</value>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <!-- 0.98 后的新变动,之前版本没有.port,默认端口为 60000 -->
  <property>
    <name>hbase.master.port</name>
    <value>16000</value>
  </property>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>hadoop001</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/opt/module/zookeeper/zkData</value>
  </property>
</configuration>

 

修改 hbase-env.sh 文件

vim hbase-env.sh

 export JAVA_HOME=/opt/module/java

 

启动master节点

./bin/hbase-daemon.sh start master

 

启动 regionserver节点

./bin/hbase-daemon.sh start regionserver

 

查看服务

jps

 

 

 

hbase shell 进入数据库

./bin/hbase shell

 

创建表

create

hbase(main):006:0> create 'student','info' 0 row(s) in 1.2830 seconds => Hbase::Table - student

 

 

查看当前namespace 下有哪些表

list

hbase(main):007:0> list
TABLE
student
1 row(s) in 0.0030 seconds

=> ["student"]

 

posted @ 2020-09-08 14:42  caocong  阅读(338)  评论(0编辑  收藏  举报