Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connecting to RedisCluster in a different namespace using Jedis #1113

Open
faisalqublan opened this issue Oct 26, 2024 · 0 comments
Open

Connecting to RedisCluster in a different namespace using Jedis #1113

faisalqublan opened this issue Oct 26, 2024 · 0 comments
Labels
question Further information is requested

Comments

@faisalqublan
Copy link

Describe your question

I've a spring boot app that uses jedis to connect to Redis cluster, I've configured it as below and it's successfully connects to the redis cluster and verifies tls on application startup

  data:
    redis:
      ssl:
        enabled: true
      cluster:
        nodes: redis-cluster-leader-headless.redis-operator:6379
      password: ""
      timeout: 60s

however after client connects to cluster it uses the cluster nodes command to discover the topology and stores it, in my case with a 3 cluster size it will be:

redis-cluster-leader-0:6379
redis-cluster-leader-0:6379
redis-cluster-leader-0:6379

redis-cluster-follower-0:6379
redis-cluster-follower-1:6379
redis-cluster-follower-2:6379

Any cache operation after the startup of the application, it will tries to connect to the stored topology which are hostnames that is configured in the Redis cluster, and since it's not the same namespace an exception is thrown:

Caused by: java.net.UnknownHostException: redis-cluster-leader-0
	at java.base/java.net.InetAddress$CachedLookup.get(Unknown Source) ~[na:na]
	at java.base/java.net.InetAddress.getAllByName0(Unknown Source) ~[na:na]
	at java.base/java.net.InetAddress.getAllByName(Unknown Source) ~[na:na]
	at redis.clients.jedis.DefaultJedisSocketFactory.connectToFirstSuccessfulHost(DefaultJedisSocketFactory.java:58) ~[jedis-5.0.2.jar!/:na]
	at redis.clients.jedis.DefaultJedisSocketFactory.createSocket(DefaultJedisSocketFactory.java:87) ~[jedis-5.0.2.jar!/:na]
	... 176 common frames omitted

What would be the best to resolve it?

What version of redis-operator are you using?
redis-operator version:
0.18.0

Additional context

@faisalqublan faisalqublan added the question Further information is requested label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant