Stage 9 - Upgrade Zookeeper (3.4.8 -> 3.6.3)
Objective
Upgrade Apache Zookeeper from the current version 3.4.8 to version 3.6.3.
Prerequisites
syndeia-cloud-3.5.<build-version>_cassandra_zookeeper_kafka_setup.zipmedia is available.Ensure previous stages have been completed without error.
Make sure that the Zookeeper service is stopped.
Check using the below command.
systemctl status zookeeperYou can verify that it is stopped if,
Active: inactive (dead)shows up in the output.● zookeeper.service Loaded: loaded (/etc/systemd/system/zookeeper.service; enabled; vendor preset: enabled) Active: inactive (dead) since Fri 2022-09-09 07:08:09 EDT; 1h 24min ago Main PID: 8865 (code=killed, signal=KILL)If not stopped, then stop using the below command.
systemctl stop zookeeper
Steps
If you are on Linux, and connected to the Internet, the below process is automated and can be run via the syndeia-cloud-3.5_zookeeper_pre-setup.bash script included in the syndeia-cloud-3.5. build_version _cassandra_zookeeper_kafka_setup.zip media
Step 1 - Download and extract the new 3.6.3 version of Zookeeper (rename it to be consistent with previous versioned naming)
wget https://archive.apache.org/dist/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz -O zookeeper-3.6.3-bin.tar.gz
sudo tar -xzf zookeeper-3.6.3-bin.tar.gz -C /opt/
sudo mv /opt/apache-zookeeper-3.6.3-bin /opt/zookeeper-3.6.3Step 2 - Copy over logs folder from old ZK version.
sudo cp -R /opt/zookeeper-3.4.8/logs /opt/zookeeper-3.6.3/.Step 3 - Check for the presence of an /etc/zookeeper/conf/myid file and that it has a single value: its ZK node id.
Run the following command:
cat /etc/zookeeper/conf/myidIf the above returns an error, create it as below:
echo "1" | sudo tee /etc/zookeeper/conf/myid >/dev/null
Step 4 - Add snapshot.trust.empty=true to the end of Apache Zookeeper's config file (/etc/zookeeper/conf/zoo.cfg) to allow startup for initial snapshot creation (see ZOOKEEPER-3056 for more info).
Step 5 - Update symlink.
sudo ln -nfs /opt/zookeeper-3.6.3 /opt/zookeeper-currentStep 6 - Take ownership of the extracted folder & the symlink.
sudo chown -R zookeeper:kafka-zookeeper /opt/zookeeper-current
sudo chown -R zookeeper:kafka-zookeeper /opt/zookeeper-3.6.3Step 7 - Copy in new ZK systemd service file.
sudo cp syndeia-cloud-${SC_version}_cassandra_zookeeper_kafka_setup/conf/init/systemd/zookeeper.service /etc/systemd/system/.Step 8 - Load the new service file.
sudo systemctl daemon-reloadStep 9 - Start Zookeeper service.
sudo systemctl start zookeeperStep 10 - Confirm Zookeeper started successfully & there are no errors in the ZK service’s log.
systemctl --type=service --state=active | grep zookeeper
sudo systemctl status zookeeperStep 11 - Stop Zookeeper service.
sudo systemctl stop zookeeperStep 12 - Edit /etc/zookeeper/conf/zoo.cfg and remove previously added snapshot.trust.empty setting.
Step 13 - Start Zookeeper service
sudo systemctl start zookeeperVerification
Ensure new version of Zookeeper is running and there are no errors in the journal /log file.