Skip to content

Building HBase

aborkar-ibm edited this page Sep 13, 2022 · 43 revisions

Building HBase

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

  • RHEL (7.8, 7.9, 8.4, 8.6, 9.0)
  • SLES (12 SP5, 15 SP3, 15 SP4)
  • Ubuntu (18.04, 20.04, 22.04)

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 JDK 8

  • RHEL (7.8, 7.9, 8.4, 8.6, 9.0)

    • With IBM SDK

      sudo yum install -y git wget tar make gcc ant hostname
      • RHEL (7.8, 7.9, 8.4, 8.6)
        sudo yum install -y java-1.8.0-ibm-devel
      • RHEL 9.0
        Download and install IBM SDK Version 8 from here.
    • With OpenJDK

      sudo yum install -y git wget tar make gcc ant hostname java-1.8.0-openjdk-devel
    • With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9)

      sudo yum install -y git wget tar make gcc ant hostname
      • Download and Install IBM Semeru Runtime (Java 8) from here.
    • With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hostpot)

      sudo yum install -y git wget tar make gcc ant hostname
      • Download and Install Adoptium Temurin Runtime (Java 8) from here.
  • SLES (12 SP5, 15 SP3, 15 SP4)

    • With IBM SDK

      sudo zypper install -y git wget tar make gcc ant gawk gzip 
      sudo zypper install java-1_8_0-ibm-devel
    • With OpenJDK

      sudo zypper install -y git wget tar make gcc ant gawk gzip java-1_8_0-openjdk-devel
    • With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9)

      sudo zypper install -y git wget tar make gcc ant gawk gzip 
      • Download and Install IBM Semeru Runtime (Java 8) from here.
    • With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hostpot)

      sudo zypper install -y git wget tar make gcc ant gawk gzip 
      • Download and Install Adoptium Temurin Runtime (Java 8) from here.
  • Ubuntu (18.04, 20.04, 22.04)

    • With IBM SDK

      sudo apt-get update
      sudo apt-get install -y git wget tar make gcc libjffi-jni hostname
      export LD_LIBRARY_PATH=/usr/lib/s390x-linux-gnu/jni/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
      • Download IBM Java 8 SDK binary from IBM Java 8 and follow the instructions as per the given link.
    • With OpenJDK

      sudo apt-get update
      sudo apt-get install -y git wget tar make gcc libjffi-jni openjdk-8-jdk hostname
      export LD_LIBRARY_PATH=/usr/lib/s390x-linux-gnu/jni/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    • With IBM Semeru Runtime (previously known as AdoptOpenJDK openj9)

      sudo apt-get update
      sudo apt-get install -y git wget tar make gcc libjffi-jni hostname
      export LD_LIBRARY_PATH=/usr/lib/s390x-linux-gnu/jni/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
      • Download and Install IBM Semeru Runtime (Java 8) from here.
    • With Eclipse Adoptium Temurin Runtime (previously known as AdoptOpenJDK hostpot)

      sudo apt-get update
      sudo apt-get install -y git wget tar make gcc libjffi-jni hostname
      export LD_LIBRARY_PATH=/usr/lib/s390x-linux-gnu/jni/${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
      • Download and Install Adoptium Temurin Runtime (Java 8) from here.

Note: At the time of creation of these build instructions, HBase 2.4.14 was verified with IBM Java 8 SDK (build 8.0.7.11), OpenJDK 8 (build 1.8.0_342), Adoptium Temurin Runtime (build 1.8.0_292-b10) and IBM Semeru Runtime (build 1.8.0_312-b07).

1.2) Install libffi library (Only for Adoptium Temurin Runtime On SLES and Ubuntu (20.04, 22.04))

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

Set environment variable LD_LIBRARY_PATH: (Only on SLES)

export LD_LIBRARY_PATH=/usr/local/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Set environment variable LD_LIBRARY_PATH: (Only on Ubuntu (20.04, 22.04))

export LD_LIBRARY_PATH=/usr/local/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

1.3) Set environment variable for JDK

export JAVA_HOME=<path to java>
export PATH=$JAVA_HOME/bin:$PATH

1.4) Build libjffi (Only on RHEL and SLES)

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

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.4.14/hbase-2.4.14-bin.tar.gz
tar xvf hbase-2.4.14-bin.tar.gz

Step 2: Verification (optional)

Note:

- Before running HBase, environment variable LD_LIBRARY_PATH needs to be set correctly. Please refer to Step 1.1) or 1.4) on how to set LD_LIBRARY_PATH after installing or building libjffi, and also Step 1.2) on how to set LD_LIBRARY_PATH after building libffi when using Adoptium Temurin Runtime on some distributions.

- Run sudo zypper install hostname command on SLES 15.x to install hostname dependency.

Use the following commands to run HBase server:

cd $SOURCE_ROOT/hbase-2.4.14
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:

bin/hbase shell

The output should contain logs similar to:

Version 2.4.14, r2e7d75a892000071a7479b2f668c4db7a241be3f, Tue Aug 23 23:33:09 UTC 2022

In hbase shell console, type in the following commands:

hbase:001:0> create 'test', 'cf'
Created table test
Took 2.5712 seconds
=> Hbase::Table - test
hbase:002:0> list 'test'
TABLE
test
1 row(s)
Took 0.0638 seconds
=> ["test"]
hbase:003:0> put 'test', 'row1', 'cf:a', 'value1'
Took 0.5492 seconds
hbase:004:0> put 'test', 'row2', 'cf:b', 'value2'
Took 0.0087 seconds
hbase:005:0> put 'test', 'row3', 'cf:c', 'value3'
Took 0.0084 seconds
hbase:006:0> scan 'test'
ROW                                      COLUMN+CELL
 row1                                    column=cf:a, timestamp=2022-05-25T06:52:53.703, value=value1
 row2                                    column=cf:b, timestamp=2022-05-25T06:53:02.219, value=value2
 row3                                    column=cf:c, timestamp=2022-05-25T06:53:06.634, value=value3
3 row(s)
Took 0.2340 seconds
hbase:007:0> get 'test', 'row1'
COLUMN                                   CELL
 cf:a                                    timestamp=2022-05-25T06:52:53.703, value=value1
1 row(s)
Took 0.0788 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:

bin/stop-hbase.sh

References

Clone this wiki locally