Command Line Installation
Also available as:
PDF
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 zookeeper-env.sh file and modify the properties based on your environment including the JDK version you downloaded.

  3. Edit the zookeeper-env.sh 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. Edit the zoo.cfg file to match your cluster environment. Below is an example of a typical zoo.cfs file:

    dataDir=$zk.data.directory.path
    server.1=$zk.server1.full.hostname:2888:3888
    server.2=$zk.server2.full.hostname:2888:3888
    server.3=$zk.server3.full.hostname:2888:3888
    
  5. 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/;
      chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_CONF_DIR/../;
      chmod -R 755 $ZOOKEEPER_CONF_DIR/../

      Note:

    • $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.