主题
Redis Cluster
基本信息
| 属性 | 值 |
|---|---|
| 版本 | 7.2.5-debian-12 |
| Helm 目录 | k8s-apps/04-helm/05-rediscluster/ |
| Namespace | yidun-infra |
| Release 名称 | redis-cluster0 |
| 节点标签 | rediscluster: "true" |
| 端口 | 6379 |
访问信息
yaml
# yidun-text values.yaml 中的配置
redis:
password: "jp&JK836KjXs"
nodes: "redis-cluster0-headless.yidun-infra.svc:6379"
master: "master01"常用运维
bash
# 查看 Redis Cluster 状态
kubectl exec -it redis-cluster0-0 -n yidun-infra -- \
redis-cli -a 'jp&JK836KjXs' cluster info
# 查看节点列表
kubectl exec -it redis-cluster0-0 -n yidun-infra -- \
redis-cli -a 'jp&JK836KjXs' cluster nodes
# 连接 Redis
kubectl exec -it redis-cluster0-0 -n yidun-infra -- \
redis-cli -a 'jp&JK836KjXs' -c
# 查看内存使用
kubectl exec -it redis-cluster0-0 -n yidun-infra -- \
redis-cli -a 'jp&JK836KjXs' info memory | grep used_memory_human故障排查
集群节点失联
bash
# 查看集群槽分配
redis-cli -a 'jp&JK836KjXs' cluster slots
# 修复集群
redis-cli -a 'jp&JK836KjXs' --cluster fix <任意节点IP>:6379内存不足
bash
# 查看各节点内存
for i in 0 1 2 3 4 5; do
echo "redis-cluster0-$i:"
kubectl exec redis-cluster0-$i -n yidun-infra -- \
redis-cli -a 'jp&JK836KjXs' info memory | grep used_memory_human
done