Non-Ambari Cluster Installation Guide
Also available as:
PDF
loading table of contents...

Set Directories and Permissions

Create directories and configure ownership and permissions on the appropriate hosts as described below. If any of these directories already exist, we recommend deleting and recreating them.

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 will 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 to create the appropriate directories.

  1. Execute the following commands on all nodes:

    mkdir -p $ZOOKEEPER_LOG_DIR; 
    chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_LOG_DIR;  
    chmod -R 755 $ZOOKEEPER_LOG_DIR; 
    
    mkdir -p $ZOOKEEPER_PID_DIR; 
    chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_PID_DIR;
    chmod -R 755 $ZOOKEEPER_PID_DIR;
    
    mkdir -p $ZOOKEEPER_DATA_DIR; 
    chmod -R 755 $ZOOKEEPER_DATA_DIR;
    chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOKEEPER_DATA_DIR

    where:

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

    • $ZOOKEEPER_LOG_DIR is the directory to store the ZooKeeper logs. For example, /var/log/zookeeper.

    • $ZOOKEEPER_PID_DIR is the directory to store the ZooKeeper process ID. For example, /var/run/zookeeper.

    • $ZOOKEEPER_DATA_DIR is the directory where ZooKeeper will store data. For example, /grid/hadoop/zookeeper/data.

  2. Initialize the ZooKeeper data directories with the 'myid' file. Create one file per ZooKeeper server, and put the number of that server in each file:

    vi $ZOOKEEPER_DATA_DIR/myid

    • In the myid file on the first server, enter the corresponding number: 1

    • In the myid file on the second server, enter the corresponding number: 2

    • In the myid file on the third server, enter the corresponding number: 3