What is a proper way to connect to AWS Elasticache (Redis cluster) from Java?

Viewed 15216

I'm new to AWS Elasticache redis, and I got below endpoint.

Image

I'm confused in either using Jedis and Redisson, because both provides single connection and cluster connection class.

Like in Jedis, for a single connection we can use:

Jedis conn = new Jedis("endpoint_address");

And for cluster connection we use:

Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
jedisClusterNodes.add(new HostAndPort("redis_cluster_ip", 7379));
JedisCluster jc = new JedisCluster(jedisClusterNodes);

These option also occur when I want to use Redisson. I'm not try to compare these two lib, my question is: WHICH ONE is the right method of connecting to AWS Redis Elasticache cluster, when you only have one end-point and still can utilize AWS auto scaling feature?

Expected answer is: use SINGLE or CLUSTER MODE.

Thanks :)

2 Answers
Related