其他分享
首页 > 其他分享> > 9、安装HBase

9、安装HBase

作者:互联网

安装HBase

分布式数据库

版本选择:HBase2.4.0

start-all.sh启动Hadoop,zkServer.sh start启动各节点的 zkServer 服务

image-20211108102837269

image-20211108094928922

image-20211108094945474

cd /usr/local
wget https://archive.apache.org/dist/hbase/2.4.0/hbase-2.4.0-bin.tar.gz
tar -zxvf hbase-2.4.0-bin.tar.gz
mv hbase-2.4.0 hbase

image-20211108103252058

配置HBase

cd /usr/local/hbase/conf
vi hbase-env.sh

export JAVA_HOME=/usr/local/jdk1.8.0_301
export HBASE_PID_DIR=/usr/local/hbase
export HBASE_MANAGES_ZK=false

vi regionservers

hadoop02
hadoop03

vi backup-masters
hadoop02

image-20211108104020307

image-20211108103818884

mkdir /usr/local/hbase/tmp
vi hbase-site.xml

<property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <!-- 设置HRegionServers共享目录 -->
  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://hadoop01:9000/hbase</value>
  </property>
  <!-- 指定Zookeeper集群位置 -->
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>hadoop02:2181,hadoop03:2182</value>
  </property>
  <!-- 指定独立Zookeeper安装路径 -->
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/usr/local/zookeeper</value>
  </property>
  <!-- 指定ZooKeeper集群端口 -->
  <property>
    <name>hbase.zookeeper.property.clientPort</name>
    <value>2181</value>
  </property>
  <property>
    <name>hbase.tmp.dir</name>
    <value>/usr/local/hbase/tmp/</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>
  <property>
    <name>dfs.datanode.max.transfer.threads</name>
    <value>4096</value>
  </property>
  <!-- 文件异步读写配置 -->
  <property>
    <name>hbase.wal.provider</name>
    <value>filesystem</value>
  </property>

image-20211108145350458

cp /usr/local/hadoop/etc/hadoop/hdfs-site.xml /usr/local/hbase/conf/
scp -r /usr/local/hbase root@hadoop02:/usr/local/
scp -r /usr/local/hbase root@hadoop03:/usr/local/

vi /etc/profile配置环境变量:

export HBASE_HOME=/usr/local/hbase
export PATH=$PATH:$HBASE_HOME/bin
export CALSSPATH=.:${HBASE_HOME}/lib:$CLASSPATH

开启HBase:

start-hbase.sh

Hadoop01:

image-20211108110856685

Hadoop02:

image-20211108123724671

Hadoop03:

image-20211108145950424

查看服务所占端口netstat -lntp

image-20211108124040390

查看其在 HDFS 中的存储信息

hdfs dfs -ls /hbase
或
hadoop fs -ls /hbase

image-20211108124105389

在Hadoop02、Hadoop03上运行 hbase shell

image-20211108124003311

测试HBase

Hbase 基本命令

在hadoop02上:
list
create 'hbase_test','f1'

在hadoop03上:
list

删除表,需先禁用表后,再执行对表的删除操作
disable ‘hbase_test’
drop ‘hbase_test’

image-20211108124859640

image-20211108124922549

浏览器查看服务的web,输入地址:http://hadoop01:16010

image-20211108125303293

image-20211108125348312

image-20211108125556256

完成。

依次创建以下四张表:

create 'tsdb',{NAME => 't', VERSIONS => 1, BLOOMFILTER => 'ROW'};

create 'tsdb-uid',{NAME => 'id', BLOOMFILTER => 'ROW'},{NAME => 'name', BLOOMFILTER => 'ROW'};

create 'tsdb-tree',{NAME => 't', VERSIONS => 1, BLOOMFILTER => 'ROW'};

create 'tsdb-meta',{NAME => 'name', BLOOMFILTER => 'ROW'};

image-20211108150139559

退出exit;

停止 hbase 服务:/usr/local/hbase/bin/stop-hbase.sh

标签:安装,export,usr,hadoop02,HBase,local,hbase
来源: https://www.cnblogs.com/xsyw/p/15560641.html