Cannot connect Locally to ElasticCache cluster on aws using Jedis Lib

Viewed 592

We are trying to access de ElasticCache (Redis) on aws using a Java client that runs locally using Jedis lib. We were able to access the redis using redis-cli locally following the steps here.

The problem is that when we try to connect to aws Redis using Jedis lib, the NAT public address are being translated to the redis private IPs in order to calculate the slots (initializeSlotsCache). We couldn't find a way to disable this. Are there any workaround?

Here's how we connect using Jedis:

    factory = new JedisConnectionFactory(new RedisClusterConfiguration(this.clusterProperties.getNodes()));
    factory.setUsePool(true);
    factory.setPoolConfig(this.jedisPoolConfig());
    factory.afterPropertiesSet();
    return factory;

We are using the mapped NAT ips for each node. But the Jedis lib is saving the private ips in the cache, so we get the following exception:

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

Any suggestions would be great! We are running out of options. Thank you in advance.

1 Answers
Related