Command Line Installation
Also available as:
loading table of contents...

Set Up the Configuration Files

You must set up several configuration files for ZooKeeper. Hortonworks provides a set of configuration files that represent a working ZooKeeper configuration. (See Download Companion Files. You can use these files as a reference point, however, you need to modify them to match your own cluster environment.

If you choose to use the provided configuration files to set up your ZooKeeper environment, complete the following steps:

  1. Extract the ZooKeeper configuration files to a temporary directory.

    The files are located in the configuration_files/zookeeper directories where you decompressed the companion files.

  2. Modify the configuration files.

    In the respective temporary directories, locate the file and modify the properties based on your environment including the JDK version you downloaded.

  3. Edit the file to match the Java home directory, ZooKeeper log directory, ZooKeeper PID directory in your cluster environment and the directories you set up above.

    See below for an example configuration:

  4. export JAVA_HOME=/usr/jdk64/jdk1.8.0_40
    export ZOOKEEPER_HOME=/usr/hdf/current/zookeeper-server
    export ZOO_LOG_DIR=/var/log/zookeeper
    export ZOOPIDFILE=/var/run/zookeeper/
    export SERVER_JVMFLAGS=-Xmx1024m
    export JAVA=$JAVA_HOME/bin/java
  5. Edit the zoo.cfg file to match your cluster environment. Below is an example of a typical zoo.cfs file:

  6. Copy the configuration files.

    • On all hosts create the config directory:

      rm -r $ZOOKEEPER_CONF_DIR ;
      mkdir -p $ZOOKEEPER_CONF_DIR ;
    • Copy all the ZooKeeper configuration files to the $ZOOKEEPER_CONF_DIR directory.

    • Set appropriate permissions:

      chmod a+x $ZOOKEEPER_CONF_DIR/; 
      chmod -R 755 $ZOOKEEPER_CONF_DIR/../


    • $ZOOKEEPER_CONF_DIR is the directory to store the ZooKeeper configuration files. For example, /etc/zookeeper/conf.

    • $ZOOKEEPER_USER is the user owning the ZooKeeper services. For example, zookeeper.