我使用这个redis-操作符:https://ot-container-kit.github.io/redis-operator/
Kubernetes部署后的情况:
pod: redis-cluster-leader-0
pod: redis-cluster-follower-0
pod: redis-cluster-leader-1
pod: redis-cluster-follower-1
pod: redis-cluster-leader-2
pod: redis-cluster-follower-2
service: redis-cluster-leader
service: redis-cluster-follower
现在,我不知道应该如何在Spring方面配置它。我看到了一些答案,说我应该列出spring.redis.cluster.nodes的所有节点,但这听起来不对,这些服务的存在是有原因的。
我能想到的可能性:
spring.redis.host=redis-cluster-leader -不工作,io.lettuce.core.RedisCommandExecutionException: MOVED 13927 10.54.37.8:6379spring.redis.cluster.nodes=redis-cluster-leader:6379,redis-cluster-follower:6379 -它工作,但我不确定它是正确的,我有errorstat_NOAUTH:count=1和errorstat_MOVED:count=1当我做INFO在redis-cli (他们是密码protected)spring.redis.cluster.nodes,我肯定觉得不对的选项2可以工作,但我不确定,主要是因为errorstat。而且,这种配置显然是为了列出节点,但我并不是列出节点,而是列出服务。当实际上有6个节点时,Spring认为有2个节点,不确定它是否有任何后果。
当我随机地杀死一些豆荚(并非全部)时,它就停止了处理应用程序端的大量错误--没有路由、没有主机、超时等等。
发布于 2021-11-10 09:20:29
您是否尝试过使用操作员也创建的无头服务?这让它对我有用。
spring.redis.host=redis-cluster-leader-headlesshttps://stackoverflow.com/questions/69087431
复制相似问题