How to pass ipv6 address in Redis connection

Tags: , ,



I am using Redisclient as following.

RedisClient redisClient = new RedisClient(RedisURI.create("redis://fe80::20c:29ff:fec5:a66b:6379"))

But it gives error as “Host name cannot be null”.

What is wrong in above code?

Answer

It needed square brackets around ipv6 address as following.

RedisClient redisClient = new RedisClient(RedisURI.create("redis://[fe80::20c:29ff:fec5:a66b]:6379"))


Source: stackoverflow