简体   繁体   English

如何配置 Redis Kubernetes 部署以使从机 redis 在主服务器宕机时接管 pod?

[英]How to configure Redis Kubernetes deployment to make slave redis pod takeover when master is down?

I have followed a tutorial to deploy Redis master and slave deployment.我按照教程部署 Redis 主从部署。 Both slave and master have its own services. slave 和 master 都有自己的服务。 I have Spring boot app that has master host in its configuration to save/read the data from it.我有 Spring 启动应用程序,它的配置中有主主机来保存/读取数据。 So when I terminate redis-master pod the Spring boot app is going down as it doesn't know that it should connect to slave.因此,当我终止 redis-master pod 时,Spring 启动应用程序正在关闭,因为它不知道它应该连接到从机。 How to solve that?如何解决? I was thinking about creating a common service for both master and slave, but this way the spring boot app will at some point try to save data to a slave pod instead of master.我正在考虑为 master 和 slave 创建一个公共服务,但是这样 spring 启动应用程序将在某个时候尝试将数据保存到 slave pod 而不是 master。

Use StatefulSets for redis deployment In HA.在 HA 中使用 StatefulSets 进行 redis 部署。 Use sentinel as sidecar container to manage failover使用 sentinel 作为 sidecar 容器来管理故障转移

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM