[Hadoop] HBase installation and configuration

0 Preparation

安装Hadoop:https://blog.csdn.net/Tiezhu_Wang/article/details/113860404
安装zookeeper:https://blog.csdn.net/Tiezhu_Wang/article/details/114576506

1 Download the installation package

Download from official website: https://hbase.apache.org/downloads.html
Installation package download

2 Unzip the installation package

After uploading the installation package to the virtual machine (here in ~/Downloads/), use the following command to extract the installation package to the /usr/local directory:

sudo tar -zxf ~/Downloads/hbase-2.3.4-bin.tar.gz -C /usr/local

After decompression is complete, you can check it out:
View HBase
modify directory permissions:

sudo chown -R hadoop /usr/local/hbase-2.3.4/

3 Configure environment variables

vim ~/.bashrc

Add the following configuration:

export HBASE_HOME=/usr/local/hbase-2.3.4
export PATH=$PATH:$HBASE_HOME/bin

Make the configuration effective:

source ~/.bashrc

Test whether the HBase installation is successful and the environment variable configuration:

hbase version

The following message appears, indicating that the installation and environment variable configuration are successful:
Configuration is successful

4 HBase configuration

4.1 hbase-env.sh

vim /usr/local/hbase-2.3.4/conf/hbase-env.sh

Add the following configuration:

export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_271
export HBASE_CLASSPATH=/usr/local/hbase-2.3.4/conf

4.2 hbase-site.xml

vim /usr/local/hbase-2.3.4/conf/hbase-site.xml

Add the following configuration in the configuration:

  <property>
    <name>hbase.rootdir</name>
    <value>hdfs://localhost:9000/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.quorum</name>
    <value>localhost</value>
    <description>The directory shared by RegionServers.
    </description>
  </property>
  <property>
    <name>hbase.cluster.distributed</name>
    <value>true</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
  </property>

Among them, hbase.rootdir specifies the storage directory of HBase; hbase.cluster.distributed sets the cluster in distributed mode.

5 Test run

Turn on HDFS and HBase in turn:

start-dfs.sh
start-hbase.sh

Enter the HBase shell:

hbase shell

Enter the command to use:
command
turn off HBase and HDFS in turn when shutting down:

stop-hbase.sh
stop-dfs.sh

Guess you like

Origin blog.csdn.net/Tiezhu_Wang/article/details/114574899