Skip to main content

Hướng dẫn cài đặt HBase trên Centos

Để cài đặt HBase trên CentOS, bạn cần làm theo các bước sau:

hbase.png

- Cài đặt Java:

sudo yum install java-1.8.0-openjdk

- Tải HBase từ trang web chính thức:

wget <https://www.apache.org/dist/hbase/2.4.7/hbase-2.4.7-bin.tar.gz>

- Giải nén tệp tin HBase:

tar -xvzf hbase-2.4.7-bin.tar.gz

- Di chuyển thư mục HBase:

cd hbase-2.4.7/

- Cấu hình tệp tin hbase-env.sh:

vi conf/hbase-env.sh

Thêm đoạn mã sau vào cuối tệp tin:

export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export HBASE_MANAGES_ZK=false

- Chỉnh sửa tệp tin hbase-site.xml:

vi conf/hbase-site.xml

Thêm đoạn mã sau vào cuối tệp tin:

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/hbase-2.4.7/data</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/hbase-2.4.7/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.
    </description>
  </property>
</configuration>

- Tạo thư mục để lưu trữ dữ liệu và khởi động HBase:

mkdir data
./bin/start-hbase.sh

- Kiểm tra xem HBase đã hoạt động chưa:

jps

Nếu bạn nhìn thấy HMasterHRegionServer trong kết quả, có nghĩa là HBase đã được cài đặt thành công.