Skip to content

Building HBase

aborkar-ibm edited this page Mar 19, 2021 · 43 revisions

Building HBase

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

  • RHEL (7.8, 7.9, 8.1, 8.2, 8.3)
  • SLES (12 SP5, 15 SP2)
  • Ubuntu (18.04, 20.04, 20.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: Build HBase using script

If you want to build HBase using manual steps, go to Step 2.

Use the following commands to build Hbase using the build script. Please make sure you have wget installed.

wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/HBase/2.3.4/build_hbase.sh

# Build Hbase
bash build_hbase.sh  [Provide -t option for executing build with tests, -j Java to be used from {AdoptJDK8_openj9, OpenJDK8}]

If the build completes successfully, go to Step 3.5. In case of error, check logs for more details or go to Step 2 to follow manual build steps.

Step 2: Build and Install HBase

export SOURCE_ROOT=/<source_root>/

2.1) Install dependencies

  • RHEL (7.8, 7.9)

    • With OpenJDK

      sudo yum install -y git wget tar make gcc ant unzip hostname gcc-c++ java-1.8.0-openjdk-devel
    • With AdoptOpenJDK

      sudo yum install -y git wget tar make gcc ant unzip hostname gcc-c++
      • Download and install AdoptOpenJDK 8 with OpenJ9 from here.
  • RHEL (8.1, 8.2, 8.3)

    • With OpenJDK

      sudo yum install -y git wget tar make gcc maven ant unzip hostname gcc-c++ java-1.8.0-openjdk-devel
    • With AdoptOpenJDK

      sudo yum install -y git wget tar make gcc maven ant unzip hostname gcc-c++
      • Download and install AdoptOpenJDK 8 with OpenJ9 from here.
  • SLES (12 SP5, 15 SP2)

    • With OpenJDK

      sudo zypper install -y git wget tar make gcc ant net-tools gcc-c++ unzip awk gzip java-1_8_0-openjdk-devel
    • With AdoptOpenJDK

      sudo zypper install -y git wget tar make gcc ant net-tools gcc-c++ unzip awk gzip
      • Download and install AdoptOpenJDK 8 with OpenJ9 from here.
  • Ubuntu (18.04, 20.04, 20.10)

    • With OpenJDK

      sudo apt-get update
      sudo apt-get install -y git wget maven tar make gcc g++ ant unzip openjdk-8-jdk
    • With AdoptOpenJDK

      sudo apt-get update
      sudo apt-get install -y git wget maven tar make gcc g++ ant unzip
      • Download and install AdoptOpenJDK 8 with OpenJ9 from here.

2.2) Download and install maven (for SLES and RHEL 7.x)

cd $SOURCE_ROOT
wget https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar zxf apache-maven-3.3.9-bin.tar.gz

2.3) Set environment variable

export JAVA_HOME=<path to java>
export PATH=$JAVA_HOME/bin:$PATH
export MAVEN_OPTS="-Xms1024m -Xmx1024m"
export PATH=$SOURCE_ROOT/apache-maven-3.3.9/bin:$PATH #(for SLES and RHEL 7.x)

Note: It is highly recommended to increase the maximum memory allocation to at least -Xmx=4096m when building with OpenJDK8, as it will reduce the building time drastically and avoid getting stuck in certain unit tests.

2.4) Get the HBase source

cd $SOURCE_ROOT
git clone git://github.com/apache/hbase.git
cd hbase
git checkout rel/2.3.4

2.5) Build Protobuf 2.5.0 till step no.5 and install the Maven artifacts as follows

mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-s390_64 -Dpackaging=exe -Dfile=/<v2.5.0 build location>protobuf/src/.libs/protoc

2.6) Build Protobuf 3.11.4

For installing dependencies please follow Step 2: Install the build dependencies from Building 3.x Protobuf

cd $SOURCE_ROOT
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout v3.11.4
git submodule update --init --recursive
./autogen.sh
./configure
make
mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.11.4 -Dclassifier=linux-s390_64 -Dpackaging=exe -Dfile=/<SOURCE_ROOT>/protobuf/src/.libs/protoc

2.7) Build HBase

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<v3.11.4_source_path>/src/.libs:<v2.5.0_source_path>/src/.libs
cd $SOURCE_ROOT/hbase
mvn package -DskipTests

2.8) Run test cases(Optional)

mvn test -fn

Note: Following test failures are observed on s390x

  • Tests which are failing with OpenJDK or AdoptOpenJDK consistently

    • org.apache.hadoop.hbase.filter.TestFuzzyRowFilter: This test fails because function java.nio.Bits.unaligned() doesn't return true on s390x. This issue is been tracked here.

    • org.apache.hadoop.hbase.rsgroup.TestRSGroupMajorCompactionTTL: This test fails due to inefficient memory space. Increasing the memory allocation following Step 2.3 resolves this test case.

    • org.apache.hadoop.hbase.procedure2.store.TestProcedureStoreTracker: This test fails due to time out. Increasing surefire.timeout value in pom.xml to around 9000, resolves this test case. It may also be helpful to increase the user process resource limits as suggested by community here.

      --- a/pom.xml
      +++ b/pom.xml
      @@ -1254,7 +1254,7 @@
             <test.output.tofile>true</test.output.tofile>
      -  <surefire.timeout>900</surefire.timeout>
      +  <surefire.timeout>9000</surefire.timeout>
             <test.exclude.pattern></test.exclude.pattern>
  • Tests which are failing intermittently Note: The following is a list of tests which are passed after either increasing the timeout value or rerunning individual test.

    • org.apache.hadoop.hbase.rest.TestRESTServerSSL
    • org.apache.hadoop.hbase.types.TestCopyOnWriteMaps
    • org.apache.hadoop.hbase.io.hfile.bucket.TestVerifyBucketCacheFile
    • org.apache.hadoop.hbase.io.hfile.bucket.TestBucketCacheRefCnt
  • Tests which are failing with AdoptOpenJDK consistently (which are also observed on x86)

    • org.apache.hadoop.hbase.io.TestHeapSize
    • org.apache.hadoop.hbase.regionserver.compactions.TestCurrentHourProvider
    • org.apache.hadoop.hbase.tool.coprocessor.CoprocessorValidatorTest
    • org.apache.hadoop.hbase.util.TestJSONMetricUtil
  • Tests which are failing with OpenJDK consistently (which are also observed on x86)

    • org.apache.hadoop.hbase.regionserver.compactions.TestCurrentHourProvider
    • org.apache.hadoop.hbase.io.TestHeapSize fails due to the Zero variant of OpenJDK 8 that is supported on s390x. It is also observed on x86 when Zero variant is enabled.

Step 3: Start HBase shell

3.1) Get jffi source code

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

cd $SOURCE_ROOT
wget https://github.com/jnr/jffi/archive/1.2.0.tar.gz
tar -xvf 1.2.0.tar.gz
cd jffi-1.2.0/

3.2) Edit following files

  • $SOURCE_ROOT/jffi-1.2.0/jni/GNUmakefile

    --- a/jni/GNUmakefile
    +++ b/jni/GNUmakefile
    @@ -68,7 +68,7 @@ WERROR = -Werror
     ifneq ($(OS),darwin)
       WFLAGS += -Wundef $(WERROR)
     endif
    -WFLAGS += -W -Wall -Wno-unused -Wno-parentheses
    +WFLAGS += -W -Wall -Wno-unused -Wno-parentheses -Wno-unused-parameter
     PICFLAGS = -fPIC
     SOFLAGS = # Filled in for each OS specifically
     FFI_MMAP_EXEC = -DFFI_MMAP_EXEC_WRIT
    @@ -183,7 +183,7 @@ ifeq ($(OS), darwin)
     endif
    
     ifeq ($(OS), linux)
    -  SOFLAGS = -shared -mimpure-text -static-libgcc -Wl,-soname,$(@F) -Wl,-O1
    +  SOFLAGS = -shared -static-libgcc -Wl,-soname,$(@F) -Wl,-O1
       CFLAGS += -pthread
     endif
    
  • $SOURCE_ROOT/jffi-1.2.0/libtest/GNUmakefile

    --- a/libtest/GNUmakefile
    +++ b/libtest/GNUmakefile
    @@ -45,9 +45,9 @@ TEST_OBJS := $(patsubst $(SRC_DIR)/%.c, $(TEST_BUILD_DIR)/%.o, $(TEST_SRCS))
     #   http://weblogs.java.net/blog/kellyohair/archive/2006/01/compilation_of_1.html
     JFLAGS = -fno-omit-frame-pointer -fno-strict-aliasing
     OFLAGS = -O2 $(JFLAGS)
    -WFLAGS = -W -Werror -Wall -Wno-unused -Wno-parentheses
    +WFLAGS = -W -Werror -Wall -Wno-unused -Wno-parentheses -Wno-unused-parameter
     PICFLAGS = -fPIC
    -SOFLAGS = -shared -mimpure-text -Wl,-O1
    +SOFLAGS = -shared -Wl,-O1
     LDFLAGS += $(SOFLAGS)
    
     IFLAGS = -I"$(BUILD_DIR)"

3.3) Build with ant

ant jar

Note: There are some test case failures. The library file is created in /<source_root>/jffi-1.2.0/build/jni/libjffi-1.2.so

3.4) Add libjffi-1.2.so to jruby-complete-9.1.17.0.jar for s390x

mkdir $SOURCE_ROOT/jar_tmp
cp ~/.m2/repository/org/jruby/jruby-complete/9.1.17.0/jruby-complete-9.1.17.0.jar $SOURCE_ROOT/jar_tmp
cd $SOURCE_ROOT/jar_tmp
jar xf jruby-complete-9.1.17.0.jar
mkdir jni/s390x-Linux
cp $SOURCE_ROOT/jffi-1.2.0/build/jni/libjffi-1.2.so jni/s390x-Linux
jar uf jruby-complete-9.1.17.0.jar jni/s390x-Linux/libjffi-1.2.so
mv jruby-complete-9.1.17.0.jar ~/.m2/repository/org/jruby/jruby-complete/9.1.17.0/jruby-complete-9.1.17.0.jar

3.5) Start HBase shell

cd $SOURCE_ROOT/hbase
bin/start-hbase.sh
bin/hbase shell

Note: On SLES you may get following messages during shell startup

[INFO] Unable to bind key for unsupported operation: up-history
[INFO] Unable to bind key for unsupported operation: down-history

Modify /etc/inputrc and replace up-history by previous-history and down-history by next-history to avoid such messages.

References

https://hbase.apache.org/ https://github.com/apache/hbase

Clone this wiki locally