Upgrading ZooKeeper from CDH3 to CDH4
This affects you if you were running ZooKeeper under CDH3. A change to the CDH4 ZooKeeper server RPM packaging has relocated the data directory default to /var/lib/zookeeper from the CDH3 default /var/zookeeper. Make sure you follow the instructions under Step 4 below.
To upgrade ZooKeeper from CDH3 to CDH4, uninstall the CDH3 version (if you have not already done so) and then install the CDH4 version. Proceed as follows.
Step 1: Remove ZooKeeper
- Stop the ZooKeeper server:
$ sudo service hadoop-zookeeper-server stop
$ sudo service hadoop-zookeeper stop
depending on the platform and release.
- Remove CDH3 ZooKeeper
To remove ZooKeeper on Red Hat-compatible systems:
$ sudo yum remove hadoop-zookeeper-server $ sudo yum remove hadoop-zookeeper
To remove ZooKeeper on Ubuntu and Debian systems:
$ sudo apt-get purge hadoop-zookeeper-server $ sudo apt-get purge hadoop-zookeeperWarning
If you are upgrading an Ubuntu or Debian system from CDH3u3 or earlier, you must use apt-get purge (rather than apt-get remove) to make sure the re-install succeeds, but be aware that apt-get purge removes all your configuration data. If you have modified any configuration files, DO NOT PROCEED before backing them up.
To remove ZooKeeper on SLES systems:
$ sudo zypper remove hadoop-zookeeper-server $ sudo zypper remove hadoop-zookeeper
Step 2: Install the ZooKeeper Base Package
Step 3: Install the ZooKeeper Server Package
During uninstall, the package manager renames any configuration files you have modified from <file> to <file>.rpmsave. During re-install, the package manager creates a new <file> with applicable defaults. You are responsible for applying any changes captured in the original CDH3 configuration file to the new CDH4 configuration file. In the case of Ubuntu and Debian upgrades, a file will not be installed if there is already a version of that file on the system, and you will be prompted to resolve conflicts; for details, see Automatic handling of configuration files by dpkg.
Step 4: Edit /etc/zookeeper/conf/zoo.cfg or Move the Data Directory
After installing the new CDH4 version, you must complete this step.
Do one of the following:
- Edit the /etc/zookeeper/conf/zoo.cfg file and change the dataDir and dataLogDir properties to point to the directory that contains your CDH3 data; for example, change it from the CDH4 default /var/lib/zookeeper to the CDH3 default /var/zookeeper directory if that is where your CDH3 data resides. (Note that if the dataLogDir property is not explicitly specified, it defaults to the value of the dataDir property.) or
- Move the contents of the data directory (for example, /var/zookeeper) to /var/lib/zookeeper. Use a command such as:
sudo -u zookeeper cp -r /var/zookeeper/* /var/lib/zookeeper
In any case, after installing the new CDH4 ZooKeeper packages, verify that the dataDir (and potentially dataLogDir) specified in the CDH4 /etc/zookeeper/conf/zoo.cfg point to a valid ZooKeeper directory.
If you previously modified your CDH3 zoo.cfg configuration file (/etc/zookeeper.dist/zoo.cfg), RPM uninstall and re-install (using yum remove as in Step 1) renames and preserves a copy of your modified zoo.cfg as /etc/zookeeper.dist/zoo.cfg.rpmsave. You should compare this to the new /etc/zookeeper/conf/zoo.cfg and resolve any differences that should be carried forward (typically where you have changed property value defaults).
If your CDH3 zoo.cfg file has not been modified since installation, it will be auto-deleted when the CDH3 ZooKeeper package is removed.
Step 5: Restart the Server