Using multiple role groups
ZooKeeper uses a unique ID called myid to identify each server in the cluster. The Stackable Operator for Apache ZooKeeper assigns the myid to each Pod from the ordinal index given to the Pod by Kubernetes. This index is unique over the Pods in the StatefulSet of the role group.
When using multiple role groups in a cluster, this will lead to different ZooKeeper Pods using the same myid. Each role group is represented by its own StatefulSet, and therefore always identified starting with
In order to avoid this myid conflict, a property
myidOffset needs to be specified in each rolegroup. The
myidOffset defaults to zero, but if specified will be added to the ordinal index of the Pod.
Here the property is used on the second role group in a ZooKeeperCluster:
apiVersion: zookeeper.stackable.tech/v1alpha1 kind: ZookeeperCluster metadata: name: zookeeper spec: servers: roleGroups: primary: replicas: 2 secondary: replicas: 1 config: myidOffset: 10 (1)
secondary role group myid starts from id
primary role group will start from
0. This means, the replicas of the role group
primary should not be scaled higher than
10 which results in
primary Pods using a myid from
9, followed by the
secondary Pods starting at myid