I've been struggling to figure out how to configure Jedis for use in an AWS Elasticache non-clustered (master/slave) environment.
At first, I just configured JedisPool with something like
JedisPool jedisPool = new JedisPool("primary_node_host", 6379);
then did some operations like:
try (Jedis jedis = jedisPool.getResource()) {
// ops here
} catch (JedisException e) {
// handle exception here
}
But later realized that the replica nodes (I have 3) should be used for reads while the primary should be used for writes.
How should I be instantiating Jedis to work with this setup?
Second, do I need to specifically select a random replica node in order to do read ops or will the client handle this for me depending on what kind of operation I'm doing?
I'm somewhat new to Redis so any hints here are much appreciated.