2. 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. Use the following instructions to create appropriate directories:

  1. We strongly suggest that you edit and source the bash script files included with the companion files (downloaded in  Download Companion Files).

    Alternatively, you can also copy the contents to your ~/.bash_profile) to set up these environment variables in your environment.

  2. Execute the following commands on all nodes:

    mkdir -p $ZOO_LOG_DIR;
    chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOO_LOG_DIR;
    chmod -R 755 $ZOO_LOG_DIR;
    mkdir -p $ZOOPIDFILE;
    chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOOPIDFILE;
    chmod -R 755 $ZOOPIDFILE;
    mkdir -p $ZOO_DATA_DIR;
    chmod -R 755 $ZOO_DATA_DIR;
    chown -R $ZOOKEEPER_USER:$HADOOP_GROUP $ZOO_DATA_DIR

    where:

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

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

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

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

  3. 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 $ZOO_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 second server, enter the corresponding number:

    3


loading table of contents...