Upgrading an external ZooKeeper server
Use this procedure to upgrade the external
ZooKeeper servers that are used by Teracloud®
Streams enterprise domains.
About this task
The upgrade procedure that you use depends on how your ZooKeeper ensemble is configured.
- Rolling
upgrade: If each ZooKeeper server is running on a dedicated machine and
the
hostname
orzkconnect string
is not changing, you can upgrade the server while the Teracloud® Streams domains are running. -
Standard
upgrade: If the ZooKeeper servers share a machine or there are changes to
the
hostname
orzkconnect string
, you must perform a standard upgrade on each server. Teracloud® Streams domains must be stopped before performing the upgrade.
Procedure
-
For a rolling upgrade, complete the following steps:
- Stop any ZooKeeper watchdog or monitor that restarts the ZooKeeper server.
- Verify that the ZooKeeper ensemble is up and running by using the ZooKeeper srvr or stat command. For a srvr command example, see the ZooKeeper setup procedure.
- Stop one of the ZooKeeper servers that is defined in the
zoo.cfg file and verify that
a quorum still exists.
In the following example, the ZooKeeper ensemble includes
zkserver1
,zkserver2
andzkserver3
. The client port number is2181
.- To stop
zkserver1
, enter the following command onzkserver1
:ZooKeeper-installation-directory/bin/zkServer.sh stop
- To verify that a quorum still exists, use the
srvr command and specify
another server in the ZooKeeper
ensemble on the command, for
example:
echo srvr | nc zkserver2 2181
If a quorum exists, the srvr command output includes information about the ZooKeeper version, latency, and other information as shown in the following example:Zookeeper version: 3.8.4-9316c2a7a97e1666d8f4593f34dd6fc36ecc436c, built on 2024-02-12 22:16 UTC Latency min/avg/max: 0/4/2834 Received: 14529333776 Sent: 14758752055 Connections: 1616 Outstanding: 4 Zxid: 0x952925303 Mode: follower Node count: 237674
- To stop
- Back up the following directories on the server:
- dataDir
- dataLogDir, if specified in the zoo.cfg file
- Perform the upgrade on the server.
- Copy the content in the following directories to the upgraded server:
- dataDir
- dataLogDir, if specified in the zoo.cfg file
- If applicable, transfer the following files to the upgraded server:
- zoo.cfg
- java.env
- log4j.properties
- Verify that the zoo.cfg file references the correct file path for the dataDir and dataLogDir directories, and that the myid files are configured correctly.
- Restart the upgraded ZooKeeper server, for example:
ZooKeeper-installation-directory/bin/zkServer.sh start
- Repeat Steps 2-9 for the other ZooKeeper servers in the ensemble.
- After all servers in the ensemble are upgraded, restart the ZooKeeper watchdog or monitor, if applicable.
-
For a standard upgrade, complete the following steps:
- Stop the Teracloud®
Streams domains that are using the ZooKeeper
ensemble. To stop a domain, enter the following command:
streamtool stopdomain -d domain-id
- Log in as user root on each Teracloud®
Streams resource that is running the domain controller service as a Linux™ system service, and enter the
following command:
streamtool stopdomainhost -d domain-id
- Stop any ZooKeeper watchdog or monitor that restarts the ZooKeeper server.
- Stop the ZooKeeper servers. To stop a ZooKeeper server, enter the following command on the
server:
ZooKeeper-installation-directory/bin/zkServer.sh stop
- Back up the following directories on each server:
- dataDir
- dataLogDir, if specified in the zoo.cfg file
- Perform the upgrade on each server.
- If applicable, transfer the following files to each server:
- zoo.cfg
- java.env
- log4j.properties
- Verify that the zoo.cfg file references the correct file path for the dataDir and dataLogDir directories, and that the myid files are configured correctly for each server.
- Copy the content in the following directories to each server:
- dataDir
- dataLogDir, if specified in the zoo.cfg file
- Restart each of the upgraded ZooKeeper servers. To start a ZooKeeper server, enter the following command on the
server:
When a quorum is formed, the data are automatically replicated to the servers in the quorum.ZooKeeper-installation-directory/bin/zkServer.sh start
- Verify that the ZooKeeper ensemble is up and running by using the ZooKeeper srvr or stat command. For a srvr command example, see the ZooKeeper setup procedure.
- After all servers in the ensemble are upgraded, restart the ZooKeeper watchdog or monitor, if applicable.
- Log in as user root on each Teracloud®
Streams resource that is running the domain controller service as a Linux™ system service, and complete the
following steps for each domain:
- Update the zkconnect
property in the following file to the proper
value:
/etc/teracloud/streams/domain-id/controller.properties
- Start the domain controller service on the resource by entering the following
command:
streamtool startdomainhost -d domain-id
- Update the zkconnect
property in the following file to the proper
value:
- Start the Teracloud®
Streams domains. To start a domain, enter the following
command:
streamtool startdomain -d domain-id
- Stop the Teracloud®
Streams domains that are using the ZooKeeper
ensemble. To stop a domain, enter the following command: