When connecting AWS Redis to Redisson what node addresses to use

405 views Asked by At

I am trying to use Redisson to connect to AWS Redis NOT clustered. There are 2 endpoints provided with such a AWS Redis configuration:

  • Primary endpoint: master.redis-name-uswest2.nnnnnn.usw2.cache.amazonaws.com:6379
  • Reader endpoint: replica.redis-name-uswest2.nnnnnn.usw2.cache.amazonaws.com:6379

When configuring Redisson in code should I be providing both endpoints, like so?

public class Application {
    public static void main( String[] args ) {
        // AWS Elasticache Replicated config

        Config config = new Config();
        config.useReplicatedServers()
              .addNodeAddress("rediss://master.redis-name-uswest2.nnnnnn.usw2.cache.amazonaws.com:6379")
              .addNodeAddress("rediss://replica.redis-name-uswest2.nnnnnn.usw2.cache.amazonaws.com:6379")   

If configured as above, will Redisson keep track of which server is the primary on a reassignment?

1

There are 1 answers

0
Nikita Koksharov On

It's recommended to specify all Redis nodes and not to use replica.xxxx.cache.amazonaws.com hostname for correct failover handling in ReplicatedServers mode. Since this hostname returns only a single replica address instead of all replicas.