一、该问题的重现步骤是什么?
redis集群建立在k8s上,因为改了一个配置导至redis节点的IP变了,集群还是正常的, redis客户端连接正常;
但BladeX的所有服务都连接不上了,这些服务连接的还是最原始的那些redis节点IP,
由于连不上redis集群,所有的服务都罢工了,BladeX的所有服务都重启都这样结果,
不知道这个redis集群的IP是缓存在哪里的?要重启哪个服务才能生效?
说明:修改redis的容器编排参数前的系统访问是正常的;
修改前的redis集群节点IP:
# kubectl -n redis-ns get pod -o wide
-------------------------------------------------------------------------------------------------------------------
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
redis-app-0 1/1 Running 0 23s 172.20.3.214 192.168.211.29
redis-app-1 1/1 Running 0 21s 172.20.1.225 192.168.211.31
redis-app-2 1/1 Running 0 20s 172.20.2.23 192.168.211.28
redis-app-3 1/1 Running 0 18s 172.20.3.215 192.168.211.29
redis-app-4 1/1 Running 0 16s 172.20.2.24 192.168.211.28
redis-app-5 1/1 Running 0 15s 172.20.1.226 192.168.211.31
-------------------------------------------------------------------------------------------------------------------
[root@k8s-master redis-k8s]# kubectl -n redis-ns get svc
----------------------------------------------------------------------------------------
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
redis-access-service NodePort 10.68.23.253
redis-headless ClusterIP None
----------------------------------------------------------------------------------------
修改后的redis集群节点IP:
# kubectl -n redis-ns get pod -o wide
-------------------------------------------------------------------------------------------------------------------
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
redis-app-0 1/1 Running 0 8h 172.20.3.101 192.168.211.29
redis-app-1 1/1 Running 0 8h 172.20.1.116 192.168.211.31
redis-app-2 1/1 Running 0 8h 172.20.2.144 192.168.211.28
redis-app-3 1/1 Running 0 8h 172.20.3.100 192.168.211.29
redis-app-4 1/1 Running 0 8h 172.20.2.143 192.168.211.28
redis-app-5 1/1 Running 0 8h 172.20.1.115 192.168.211.31
-------------------------------------------------------------------------------------------------------------------
[root@k8s-master redis-k8s]# kubectl -n redis-ns get svc
----------------------------------------------------------------------------------------
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
redis-access-service NodePort 10.68.23.253
redis-headless ClusterIP None
----------------------------------------------------------------------------------------
#spring配置
spring:
redis:
##redis 单机环境配置
##将docker脚本部署的redis服务映射为宿主机ip
#host: 10.68.23.253:26379
#port: 6379
password: admin@HaRedisCluster1212
database: 0
ssl: false
##redis 集群环境配置
cluster:
nodes: 10.68.23.253:6379
commandTimeout: 5000
错误信息,BladeX的所有服务都连接不上,BladeX的所有服务连接的还是最原始的那些redis节点IP, BladeX的所有服务都重启都这样.
redis DOWN
error org.springframework.data.redis.RedisConnectionFailureException:
Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException:
Unable to connect to 172.20.3.215:6379
error org.springframework.data.redis.RedisConnectionFailureException:
Redis connection failed; nested exception is io.lettuce.core.RedisConnectionException:
Unable to connect to 172.20.3.214:6379
二、你期待的结果是什么?实际看到的又是什么?
虽然redis节点的IP改变了,但k8s暴露的redis的服务的IP是不变的,为啥BladeX服务连接的还是改变前的redis节点IP呢
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
BladeX企业版v2.7.1;系统运行在k8s集群上面;
四、请提供详细的错误堆栈信息,这很重要。
五、若有更多详细信息,请在下面提供。
扫一扫访问 Blade技术社区 移动端