Zookeeper

Detailed information on the Zookeeper state store component

配置

To setup Zookeeper state store create a component of type state.zookeeper. 请参阅本指南,了解如何创建和应用状态存储配置。

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: <NAME>
  namespace: <NAMESPACE>
spec:
  type: state.zookeeper
  version: v1
  metadata:
  - name: servers
    value: <REPLACE-WITH-COMMA-DELIMITED-SERVERS> # Required. Example: "zookeeper.default.svc.cluster.local:2181"
  - name: sessionTimeout
    value: <REPLACE-WITH-SESSION-TIMEOUT> # Required. Example: "5s"
  - name: maxBufferSize
    value: <REPLACE-WITH-MAX-BUFFER-SIZE> # Optional. default: "1048576"
  - name: maxConnBufferSize
    value: <REPLACE-WITH-MAX-CONN-BUFFER-SIZE> # Optional. default: "1048576"
  - name: keyPrefixPath
    value: <REPLACE-WITH-KEY-PREFIX-PATH> # Optional.

元数据字段规范

字段必填详情Example
serversYComma delimited list of servers"zookeeper.default.svc.cluster.local:2181"
sessionTimeoutYThe session timeout value"5s"
maxBufferSizeNThe maximum size of buffer. 默认值为 "1048576""1048576"
maxConnBufferSizeNThe maximum size of connection buffer. Defautls to "1048576""1048576"
keyPrefixPathNThe key prefix path in Zookeeper. 无默认值"dapr"

Setup Zookeeper


You can run Zookeeper locally using Docker:

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

然后您可以使用 localhost:2181 与服务器交互。


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

helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
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

相关链接