9. 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.


loading table of contents...