主题
ZooKeeper
基本信息
| 属性 | 值 |
|---|---|
| 版本 | 3.9.3-debian-12 |
| Helm 目录 | k8s-apps/04-helm/01-zookeeper/ |
| Namespace | yidun-infra |
| Release 名称 | zookeeper-yidun |
| 节点标签 | zookeeper: "true" |
| 客户端端口 | 2181(NodePort) |
用途
- Kafka broker 注册与协调(Kafka 3.x 仍使用 ZooKeeper 模式)
- 易盾业务服务的配置注册与服务发现
关键配置
yaml
replicaCount: 1 # 单机
# replicaCount: 3 # 集群(自动调整)
heapSize: 1024 # JVM 堆内存 1GB
persistence:
storageClass: "local-path"
size: 8Gi # 数据存储
dataLogDir:
size: 8Gi # 日志存储(建议挂载不同磁盘)
# 允许匿名连接(内网部署,安全可接受)
allowAnonymousLogin: true
auth:
enabled: false服务地址
集群内: zookeeper.yidun-infra.svc.cluster.local:2181
yidun-text 配置:
zookeeper.url: "zookeeper.yidun-infra.svc:2181"常用运维
bash
# 查看 ZooKeeper 状态
kubectl exec -it zookeeper-yidun-0 -n yidun-infra -- \
zkServer.sh status
# 连接 ZooKeeper Shell
kubectl exec -it zookeeper-yidun-0 -n yidun-infra -- \
zkCli.sh -server localhost:2181
# 常用 ZK 命令
ls / # 列出根节点
get /services # 查看服务注册
stat /path # 查看节点状态故障排查
bash
# 检查选主状态(集群模式)
kubectl exec -it zookeeper-yidun-0 -n yidun-infra -- \
echo ruok | nc localhost 2181 # 返回 imok 表示正常
# 查看集群成员
kubectl exec -it zookeeper-yidun-0 -n yidun-infra -- \
echo mntr | nc localhost 2181 | grep zk_followers