Prerequisites
Before you configure observers, make sure that you have:- A StreamNative Private Cloud v2 deployment that uses ZooKeeper for metadata storage.
- Permission to update the
ZooKeeperClusterresource and inspect Pods, Services, and ConfigMaps in its namespace. - The name and namespace of the
ZooKeeperClusterresource. - A current backup of the ZooKeeper data.
Configure an observer
The following example configures three participants and one observer for aZooKeeperCluster named private-cloud in the pulsar namespace.
-
Confirm the names of the ZooKeeper StatefulSet and headless Service:
-
In your existing
ZooKeeperClustermanifest, setspec.replicasto the total number of participants and observers. Then add one server entry for each replica underspec.advancedOptions.staticServerList:Use these rules when you adapt the example:- Set
replicasto the number of entries inservers. - Add one entry for every Pod ordinal, starting with ordinal
0. - Set each server
idto the Pod ordinal plus 1. ZooKeeper server IDs start at1, while StatefulSet Pod ordinals start at0. For example, Podprivate-cloud-zk-0usesid: 1, and Podprivate-cloud-zk-3usesid: 4. The latter appears asserver.4in the generated ZooKeeper configuration. - Set each voting member’s role to
participantand each non-voting member’s role toobserver. - Use the fully qualified Pod hostname generated by the StatefulSet and headless Service. The default format is
<cluster-name>-zk-<ordinal>.<cluster-name>-zk-headless.<namespace>.svc.cluster.local.
- Set
-
Apply the complete manifest:
-
Wait for the
ZooKeeperClusterto become ready:
Verify the observer
-
Confirm that all ZooKeeper Pods are ready:
-
Inspect the server configuration generated by the StreamNative Operator:
The configuration contains three
participantentries and oneobserverentry. The observer entry resembles the following output: -
Check the observer Pod logs:
Log entries that contain
ObserverZooKeeperServer,observing, orObserving new leaderconfirm that the Pod is running as an observer and has connected to a leader.
Troubleshoot the configuration
If the ZooKeeper Pods don’t become ready, check the following settings:spec.replicasequals the number of entries instaticServerList.servers.- Every server ID is unique.
- Every hostname matches an existing Pod and the ZooKeeper headless Service.
- Enough servers have the
participantrole to form a voting majority. Observers don’t count toward this majority.