Currently I am using jedis to connect to my local redis server using:
pool = new JedisPool("redis://localhost:6379/10");
Then I want to use elasticache redis instead for my spring boot application. I get the primary endpoint for elasticache redis is the aws console:
*****.7xxpzn.ng.0001.use2.cache.amazonaws.com:6379
I tried to connect to the redis by using:
pool = new JedisPool("*****.7xxpzn.ng.0001.use2.cache.amazonaws.com:6379");
However it throws the error:
Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in authority at index 8: redis://*****.7xxpzn.ng.0001.use2.cache.amazonaws.com:6379
at java.net.URI.create(URI.java:852)
at redis.clients.jedis.BinaryJedis.<init>(BinaryJedis.java:31)
at redis.clients.jedis.Jedis.<init>(Jedis.java:26)
at com.quora.util.JedisAdapter.main(JedisAdapter.java:32)
Caused by: java.net.URISyntaxException: Illegal character in authority at index 8: redis://*****.7xxpzn.ng.0001.use2.cache.amazonaws.com:6379
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.parseAuthority(URI.java:3186)
at java.net.URI$Parser.parseHierarchical(URI.java:3097)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:588)
at java.net.URI.create(URI.java:850)
... 3 more
Can any expert give me some suggestion on how to connect to elasticache redis using jedis?
Thanks,
Peter
I ran into a similar issue I believe the problem is that there is a dash in your ELB host name or another special character I bet. You might have to use route53 to get around this by making an alias for it.
Another issue I ran into is a space or other white space character in the "hostname" portion (although I see the example you have above doesn't have that issue) but still just pointing it out.