How to Configure phpredis to Handle Redis Master Failover with Sentinel? #2504
-
|
I've set up Redis with high availability (HA) on three machines using Sentinel. The configuration is working well, and I have the following IP addresses for my machines: 172.29.22.8 Each Redis instance has its own IP address and they are interconnected. When the master node goes down, one of the slaves is promoted to master. I am using phpredis to connect to the Redis server. However, I'm unsure how to handle the connection in my application to ensure it connects to the current master, even when failover occurs. How can I configure phpredis to handle this situation? Additionally, if there are any best practices or configurations I should be aware of for managing this with phpredis and Redis Sentinel, please let me know. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Currently PhpRedis has only basic support of sentinel commands and doesn't provide any build-in functionality to handle master-slave failover automatically. For now you need to implement failover logic by yourself in PHP code |
Beta Was this translation helpful? Give feedback.
Currently PhpRedis has only basic support of sentinel commands and doesn't provide any build-in functionality to handle master-slave failover automatically. For now you need to implement failover logic by yourself in PHP code