Can't connect locally to ElasticCache cluster on aws using Jedis Lib

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

The problem is that when we try to connect to aws Redis using the Jedis lib, the public NAT address is translated to the private IPs of the redis in order to compute the slots (initializeSlotsCache). We couldn't find a way to turn this off. Is there a workaround?

Here we connect with Jedis:

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

      

We are using mapped NAT ips for each node. But Jedis lib keeps private ips in 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're running out of options. Thank you in advance.

+3


source to share


1 answer


You cannot connect to AWS hosted by redis outside of the AWS environment.



We ran into a similar issue and the work around us was to set up a local redis instance to test dev and unit.

0


source







All Articles