[英]Redis cluster on Google Container Engine (GKE - Kubernetes)
I have set-up redis-cluster on Kubernetes (Google Container Engine). 我在Kubernetes(Google容器引擎)上设置了redis-cluster。 Referenced from : https://github.com/zuxqoj/kubernetes-redis-cluster/blob/master/README-using-statefulset.md
引用自: https : //github.com/zuxqoj/kubernetes-redis-cluster/blob/master/README-using-statefulset.md
So the current state is that, we have 6 pods under a single node of Kubernetes Cluster, 3 pods as masters and 3 pods as slaves. 因此,当前状态是,在Kubernetes Cluster的单个节点下有6个Pod,其中3个Pod作为主节点,3个Pod作为从节点。 Have brought all the pods into redis-cluster and things are working fine.
已将所有Pod放入Redis集群,并且一切正常。
However, when I try to bring down one of the master / slave pod, kubernetes automatically starts a new pod with a new IP. 但是,当我尝试断开一个主/从Pod时,kubernetes会自动启动一个具有新IP的新Pod。 And the new IP is being auto updated in all other pods node configuration, except its own node configuration.
并且新IP将在其自身节点配置以外的所有其他Pod节点配置中自动更新。 Is there something I am missing?
我有什么想念的吗?
I am using redis 4.0.0 我正在使用Redis 4.0.0
Redis Cluster Yaml: https://drive.google.com/open?id=1oSQzYu-pAJmehaAfU_HdIa3qAJBx1n5C Redis群集Yaml: https ://drive.google.com/open ? id = 1oSQzYu-pAJmehaAfU_HdIa3qAJBx1n5C
Try using DNS hostnames instead of IP addresses. 尝试使用DNS主机名而不是IP地址。
See Helm charts that just do that: 查看执行此操作的Helm图表:
You need to update the IP of the new pod in nodes.conf. 您需要在nodes.conf中更新新容器的IP。 You can do it by running this script in the initialization of the pod.
您可以通过在Pod的初始化中运行此脚本来完成此操作。
#!/bin/sh
set -e
REDIS_NODES_FILE="/data/nodes.conf"
if [ -f ${REDIS_NODES_FILE} ]; then
if [ -z "${POD_IP}" ]; then
echo "Unable to determine Pod IP address!"
exit 1
fi
echo "Updating my IP to ${POD_IP}"
sed -i.bak -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/" ${REDIS_NODES_FILE}
fi
Originated from: https://github.com/antirez/redis/issues/5417 起源于: https : //github.com/antirez/redis/issues/5417
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.