Skip to content

Building HBase

linuxonz edited this page Jan 12, 2024 · 39 revisions

Building HBase

The instructions provided below specify the steps to build HBase version 2.5.7 on Linux on IBM Z for following distributions:

  • RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
  • SLES (12 SP5, 15 SP5)
  • Ubuntu (20.04, 22.04, 23.10)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Step 1: Download and Install HBase

export SOURCE_ROOT=/<source_root>/

1.1) Install prerequisites

  • RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
sudo yum install -y git wget tar make gcc ant hostname curl java-1.8.0-openjdk-devel
  • SLES (12 SP5, 15 SP5)
sudo zypper install -y git wget tar make gcc ant gawk gzip hostname curl java-1_8_0-openjdk-devel
  • Ubuntu (20.04, 22.04, 23.10)
sudo apt update
sudo apt-get install -y git wget tar make gcc libjffi-jni hostname curl
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/s390x-linux-gnu/jni/

1.2) Install JRE

  • With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hotspot)

    • Download and install Eclipse Adoptium Temurin Runtime 8 from here.
  • With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9)

    • Download and install IBM Semeru Runtime (Java 8) from here.
  • With OpenJDK

    • RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)

      • Java 8
      sudo yum install -y java-1.8.0-openjdk
      
    • SLES (12 SP5, 15 SP5)

      • Java 8
      sudo zypper install -y java-1_8_0-openjdk
    • Ubuntu (20.04, 22.04, 23.10)

      • Java 8
      sudo apt-get install -y openjdk-8-jre

1.3) Install libffi library (Only for Adoptium Temurin 8 Runtime)

Temurin 8 requires libffi.so.6 library.

cd "$SOURCE_ROOT"
wget ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz
tar xvfz libffi-3.2.1.tar.gz
cd libffi-3.2.1
./configure --prefix=/usr/local
make
sudo make install
sudo ldconfig /usr/local/lib /usr/local/lib64

1.4) Build libjffi (Only on RHEL and SLES)

Note: HBase needs a native library (libjffi-1.2.so: java foreign language interface). Build with java 8!

cd $SOURCE_ROOT
wget https://github.com/jnr/jffi/archive/jffi-1.2.23.tar.gz
tar -xzvf jffi-1.2.23.tar.gz
cd jffi-jffi-1.2.23
ant
export LD_LIBRARY_PATH=${SOURCE_ROOT}/jffi-jffi-1.2.23/build/jni/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

1.5) Download the HBase binary

cd $SOURCE_ROOT
wget https://archive.apache.org/dist/hbase/2.5.7/hbase-2.5.7-bin.tar.gz
tar xvf hbase-2.5.7-bin.tar.gz
export PATH=$SOURCE_ROOT/hbase-2.5.7/bin:$PATH

1.6) Set the environment

 export JAVA_HOME=<path to Java installation directory>
 export PATH=$JAVA_HOME/bin:$PATH

Step 2: Verification (optional)

Use the following commands to run HBase server:

cd hbase-2.5.7/bin
start-hbase.sh

The HBase Web UI could be accessed from http://<IP or domain name of the host>:16010 after HBase server is successfully started. Then use the following command to run hbase shell:

hbase shell

The output should contain logs similar to:

Version 2.5.7, r7ebd4381261fefd78fc2acf258a95184f4147cee, Thu Jun 22 17:42:49 PDT 2023

In hbase shell console, type in the following commands:

hbase:001:0> create 'test', 'cf'
Created table test
Took 0.9315 seconds
=> Hbase::Table - test
hbase:002:0> list 'test'
TABLE
test
1 row(s)
Took 0.0197 seconds
=> ["test"]
hbase:003:0> put 'test', 'row1', 'cf:a', 'value1'
Took 0.0970 seconds
hbase:004:0> put 'test', 'row2', 'cf:b', 'value2'
Took 0.0035 seconds
hbase:005:0> put 'test', 'row3', 'cf:c', 'value3'
Took 0.0046 seconds
hbase:006:0> scan 'test'
ROW                         COLUMN+CELL
 row1                       column=cf:a, timestamp=2022-12-20T06:43:50.334, value=value1
 row2                       column=cf:b, timestamp=2022-12-20T06:43:56.064, value=value2
 row3                       column=cf:c, timestamp=2022-12-20T06:44:03.115, value=value3
3 row(s)
Took 0.0195 seconds
hbase:007:0> get 'test', 'row1'
COLUMN                      CELL
 cf:a                       timestamp=2022-12-20T06:43:50.334, value=value1
1 row(s)
Took 0.0180 seconds
hbase:008:0> exit

If your session looks similar to the above, congrats, your standalone HBase server is operational!

Use the following commands to stop HBase server:

stop-hbase.sh

References

Clone this wiki locally