Rolling Upgrade Guide
Also available as:
PDF
loading table of contents...

Downgrade ZooKeeper

ZooKeeper is the final component in the downgrade process.

In this step you will downgrade and validate each ZooKeeper process, node by node.

  1. Sign on as the zookeeper_admin user (default = zookeeper) and run the following stat command for each node in the ZooKeeper quorum until you find the leader:

    su - zookeeper

    echo stat | nc <servername> <port> | grep Mode

    exit

    For example, to check nodes hdp1 and hdp2, assuming they use default ZooKeeper server port 2181:

    [zookeeper@hdp1 ~] echo stat | nc hdp1 2181 | grep Mode
    Mode: follower
    [zookeeper@hdp1 ~] echo stat | nc hdp2 2181 | grep Mode
    Mode: leader
    [zookeeper@hdp1 ~] exit

    As with the related upgrade step, this is an optimization step. If the leader changes later, it won’t impact the outcome of the downgrade process.

  2. Downgrade and restart each node, as follows. Downgrade the leader last.

    1. Stop the ZooKeeper server, switch to the previous version, and start the server:

      su - zookeeper -c "source /usr/hdp/current/zookeeper-server/conf/zookeeper-env.sh ; env ZOOCFGDIR=/usr/hdp/current/zookeeper-server/conf ZOOCFG=zoo.cfg /usr/hdp/current/zookeeper-server/bin/zkServer.sh stop"

      hdp-select set zookeeper-server 2.2.0.0-2041

      su - zookeeper -c "source /usr/hdp/current/zookeeper-server/conf/zookeeper-env.sh ; env ZOOCFGDIR=/usr/hdp/current/zookeeper-server/conf ZOOCFG=zoo.cfg /usr/hdp/current/zookeeper-server/bin/zkServer.sh start"

    2. Make sure that the ZooKeeper quorum has been reestablished before downgrading the next node. To check this, create a new znode on the node just downgraded, and then list the created znode.

      For example, start a zkcli process (ZooKeeper shell) that points to the local host (zkcli is in /usr/hdp/current/zookeeper-server/bin):

      ./zkCli.sh localhost

      Create a znode called znode-1. Associate the string my_data with the node:

      [zk: node-1:2181(CONNECTED) 20] create /znode-1 my_data
      Created /znode-1

      List the node-1 test directory:

      [zk: node-1:2181(CONNECTED) 21] ls /znode-1
      []

      Remove the test node and exit zkcli:

      [zk: node-1:2181(CONNECTED) 22] delete /znode-1
      [zk: node-1:2181(CONNECTED) 21] quit
      [hdp@node-1 bin]#
    3. Repeat the validation step until successful or until you have completed ten attempts. If the test does not succeed after ten tries, see if the ZooKeeper process is running. If not, check ZooKeeper logs for an indication of the problem.

  3. After downgrading ZooKeeper successfully on each node, restart the leader node.