• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
ZooKeeper | Install and configure a ZooKeeper Standalone Server
  1. Download and Install Apache ZooKeeper
  2. ZooKeeper Configuration
  3. Start/Stop ZooKeeper

  1. Download and Install Apache ZooKeeper
    Download Apache ZooKeeper "3.9.3": http://zookeeper.apache.org/releases.html

    Extract the file "apache-zookeeper-3.9.3-bin.tar.gz" in the folder you want to install ZooKeeper:
    ► /opt/apache-zookeeper-3.9.3-bin


    Optional: Create a symbolic link of the ZooKeeper installation folder:

    Change the folders permissions (if needed):
  2. ZooKeeper Configuration
    • Create the folder "data": "/opt/zookeeper/data"

    • Create the folder "data-log": "/opt/zookeeper/data-log"

    • Create the log folder: "/opt/zookeeper/logs"

    • Copy the file "/opt/zookeeper/conf/zoo_sample.cfg" to "/opt/zookeeper/conf/zoo.cfg"

    • Define the property "dataDir" in the file "/opt/zookeeper/conf/zoo.cfg": dataDir=/opt/zookeeper/data

    • Define the property "dataLogDir" in the file "/opt/zookeeper/conf/zoo.cfg": dataLogDir=/opt/zookeeper/data-log

    Make sure that the directories and the files are created and updated using the user that will run ZooKeeper (you can also use: sudo -u mtitek mkdir data).

    Example: ZooKeeper configuration file "zoo.cfg"

    Notes:
    • If you run ZooKeeper in a cluster mode, the clientPort and clientPortAddress configuration parameters should be part of the ZooKeeper instances configuration (see Installation - ZooKeeper Cluster).

    • (On Windows) if not already the case, you have to double-quote the path "%JAVA_HOME%"\bin\java.exe in the file "%ZK_HOME%\bin\zkEnv.cmd"

    • (On Windows) if not already the case, you have to double-quote the path "%JAVA%" in the file "%ZK_HOME%\bin\zkServer.cmd"

    Other configuration you might want to setup in file "zoo.cfg"

    You can optionally configure the JAVA_HOME environment variable:
  3. Start/Stop ZooKeeper
    Start ZooKeeper:

    Stop ZooKeeper:

    Notes:
    • By default ZooKeeper will try to use the configuration file found in "/opt/zookeeper/conf/zoo.cfg"

    • You can specify a custom configuration file by posting its path after the "start" and "stop" parameters:

    • You can specify a custom configuration folder by using the option "--config" before the "start" and "stop" parameters:

© 2025  mtitek