Zookeeper

Detailed information on the Zookeeper state store component

Component format

To setup Zookeeper state store create a component of type state.zookeeper. See this guide on how to create and apply a state store configuration.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. namespace: <NAMESPACE>
  6. spec:
  7. type: state.zookeeper
  8. version: v1
  9. metadata:
  10. - name: servers
  11. value: <REPLACE-WITH-COMMA-DELIMITED-SERVERS> # Required. Example: "zookeeper.default.svc.cluster.local:2181"
  12. - name: sessionTimeout
  13. value: <REPLACE-WITH-SESSION-TIMEOUT> # Required. Example: "5s"
  14. - name: maxBufferSize
  15. value: <REPLACE-WITH-MAX-BUFFER-SIZE> # Optional. default: "1048576"
  16. - name: maxConnBufferSize
  17. value: <REPLACE-WITH-MAX-CONN-BUFFER-SIZE> # Optional. default: "1048576"
  18. - name: keyPrefixPath
  19. value: <REPLACE-WITH-KEY-PREFIX-PATH> # Optional.

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

Spec metadata fields

FieldRequiredDetailsExample
serversYComma delimited list of servers“zookeeper.default.svc.cluster.local:2181”
sessionTimeoutYThe session timeout value“5s”
maxBufferSizeNThe maximum size of buffer. Defaults to “1048576”“1048576”
maxConnBufferSizeNThe maximum size of connection buffer. Defaults to “1048576“1048576”
keyPrefixPathNThe key prefix path in Zookeeper. No default“dapr”

Setup Zookeeper

You can run Zookeeper locally using Docker:

  1. docker run --name some-zookeeper --restart always -d zookeeper

You can then interact with the server using localhost:2181.

The easiest way to install Zookeeper on Kubernetes is by using the Helm chart:

  1. helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
  2. helm install zookeeper incubator/zookeeper

This installs Zookeeper into the default namespace. To interact with Zookeeper, find the service with: kubectl get svc zookeeper.

For example, if installing using the example above, the Zookeeper host address would be:

zookeeper.default.svc.cluster.local:2181

Last modified September 20, 2021 : Merge pull request #1800 from greenie-msft/gRPC_proxying_video (36dff3c)