Building Apache ZooKeeper - linux-on-ibm-z/docs GitHub Wiki

Building Apache ZooKeeper

Below versions of Apache ZooKeeper are available in respective distributions at the time of creation of these instructions:

  • Ubuntu (20.04, 22.04) has 3.4.13
  • Ubuntu (23.04, 23.10) has 3.8.0

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.

Apache ZooKeeper binaries are available and can be downloaded from here. To use these binaries, different Java flavors can be installed on mentioned distributions.

Note: Apache ZooKeeper(v3.9.2) was verified at the time of creation of these instructions

1. Install Java

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

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

    • Download and install IBM Semeru Runtimes (Java 8, 11 or 17) from here
  • With OpenJDK 8

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

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

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

      sudo apt-get update
      sudo apt-get install -y openjdk-8-jdk
      
  • With OpenJDK 11

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

      sudo yum install -y java-11-openjdk
      
    • SLES (12 SP5, 15 SP5)

      sudo zypper install -y java-11-openjdk-devel
      
    • Ubuntu (20.04, 22.04, 23.10)

      sudo apt-get update
      sudo apt-get install -y openjdk-11-jdk
      
  • With OpenJDK 17

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

      sudo yum install -y java-17-openjdk
      
    • SLES 15 SP5

      sudo zypper install -y java-17-openjdk
      
    • Ubuntu (20.04, 22.04, 23.10)

      sudo apt-get update
      sudo apt-get install -y openjdk-17-jdk
      

Build libffi library for AdoptOpenJDK8

  • Only for (Ubuntu 20.04, Ubuntu 22.04, Ubuntu 23.10, RHEL 9.x and SLES)

     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
     sudo ldconfig /usr/local/lib64
    

2. Set Environment Variables

export JAVA_HOME=<Path to Java>
export PATH=$JAVA_HOME/bin:$PATH

3. Start server

To start the server, extract binary tar to /<source_root>/ and follow steps given below.

cd /<source_root>/<apache_zookeeper_binary_folder>/
mv conf/zoo_sample.cfg conf/zoo.cfg

bin/zkServer.sh start
bin/zkCli.sh

Note:

  • If encountering error message 'Starting zookeeper ... FAILED TO START', please check whether 'ps' command is enabled in bash.
  • User can rename existing sample config file or create their own zoo.cfg.

References: