HBase stand-alone version installation and deployment

1. To prepare the environment before installation, you need a centos7 machine and install JDK and Hadoop.

Reference: Stand-alone installation and deployment of Hadoop2.7.3 on centos7
Note : You need to pay attention to the version of hadoop and the version of HBase

Centos version: CentOS-7.4-x86_64-DVD-1708.iso
JDK version: jdk-8u231-linux-x64.tar.gz
Hadoop version: hadoop-2.7.3.tar.gz
HBase version: hbase-2.2.6-bin .tar.gz

2. Download the HBase installation package

Insert picture description here

Download link: https://mirrors.bfsu.edu.cn/apache/hbase/2.2.6/hbase-2.2.6-bin.tar.gz

3. Install and deploy HBase

3.1 Create a new hbase directory under the /usr/ directory, upload the hbase installation package hbase-2.2.6-bin.tar.gz to the hbase directory, and decompress it

tar -zxvf hbase-2.2.6-bin.tar.gz

Insert picture description here

3.2 Modify the /usr/hbase/hbase-2.2.6/conf/hbase-env.sh file, to import Java environment variables, add the following content at the end of the file:

export JAVA_HOME=/usr/java/jdk1.8.0_231

Insert picture description here

3.3 Execute the following statement to create the corresponding directory

mkdir -p /usr/hbase/hbase-2.2.6/hbase/
mkdir -p /usr/hbase/hbase-2.2.6/zookeeper/

3.4 Modify the contents of the /usr/hbase/hbase-2.2.6/conf/hbase-site.xml file as follows:

<configuration>
  <!-- hbase存放数据目录 -->
  <property>
    <name>hbase.rootdir</name>
    <value>file:///data/soft/hbase-2.2.6/hbase</value>

  </property>

  <!-- ZooKeeper数据文件路径 -->
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/usr/hbase/hbase-2.2.6/zookeeper</value>
  </property>

  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    <description>
      Controls whether HBase will check for stream capabilities (hflush/hsync).

      Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
      with the 'file://' scheme, but be mindful of the NOTE below.

      WARNING: Setting this to false blinds you to potential data loss and
      inconsistent system state in the event of process and/or node failures. If
      HBase is complaining of an inability to use hsync or hflush it's most
      likely not a false positive.
    </description>
  </property>

</configuration>

Insert picture description here

3.5 Add hbase to the environment variable, execute vi /etc/profile, add the following content to the end of the file, execute source /etc/profile to make it effective.

export HBASE_HOME=/usr/hbase/hbase-2.2.6
export PATH=$HBASE_HOME/bin:$PATH   

3.6 Start and stop hbase, enter the /usr/hbase/hbase-2.2.6/ directory

# 启动hbase
./bin/start-hbase.sh

# 停止hbase
./bin/stop-hbase.sh

Insert picture description here

Visit in the browser: http://192.168.1.9:16010/master-status
Insert picture description here

4. Use the hbase shell client to connect to HBase and perform related operations

4.1 Enter the /usr/hbase/hbase-2.2.6/ directory,

./bin/hbase shell

Insert picture description here

4.2 Use the create command to create a new table, specify the table name and ColumnFamily name.

create 'test01', 'che01'

Insert picture description here

4.3 Use the list command to confirm that your table exists

list 'test01'

Insert picture description here

4.4 Use the describe command to view detailed information, including configuration defaults

describe 'test01'

Insert picture description here

4.5 Use the put command to put the data in the table

put 'test01', 'row1', 'che01:01', 'value1'
put 'test01', 'row2', 'che01:02', 'value2'
put 'test01', 'row3', 'che01:03', 'value3'

# 
scan 'test01'

Insert picture description here

Insert picture description here

4.6 View one of my single data

get 'test01', 'row2'

Insert picture description here

Guess you like

Origin blog.csdn.net/ytangdigl/article/details/109139682