这个问题直接从stackoverflow搬运的,跟我想问的一模一样,但是目前没有答案
Our current Redis setup is a Web application client using Jedis to directly connect using one JedisPool for writes to a single Redis master and a second JedisPool for reads from a single Redis slave. The slave is setup to replicate the master.
We are in the process of moving to using the JedisSentinelPool on the client and introducing Sentinel(s) to handle failover more cleanly. As far as I know, it seems that the JedisSentinelPool only communicates with the currently elected master, so now all writes/reads go to the master. Compared to before when the reads could be distributed to the slave.
Is there any way using JedisSentinelPool to distribute the reads to the slave for load balancing purposes? Or it is necessary to implement this manually with a JedisPool (as before) In which case if the master failed, the JedisSentinelPool would now point to the old slave (new master) and the JedisPool would still dumbly point to the old slave, and effectively the old slave (new master) would now be handling reads AND writes?
Does the Redis Sentinel (or otherwise) have any load balancing (as opposed to failover) capabilities? We currently only have one slave, could adding more slaves be used for load balancing? And if so what are the recommended configurations?
Any advice, real-world experience here would be appreciated.
认证0级讲师