Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

How to connect to Redis Cluster using Quarkus Redis and port forwarding?

$
0
0

I'm trying to debug a "change hostname on redirect" issue with Quarkus Redis

This works fine:

package org.acme;import io.vertx.mutiny.core.Vertx;import io.vertx.mutiny.redis.client.Command;import io.vertx.mutiny.redis.client.Redis;import io.vertx.mutiny.redis.client.Request;import io.vertx.redis.client.RedisOptions;import javax.ws.rs.GET;import javax.ws.rs.Path;import javax.ws.rs.Produces;import javax.ws.rs.core.MediaType;import org.jboss.logging.Logger;@Path("/redis")public class RedisCommandsTest {  private static final Logger LOGGER = Logger.getLogger(RedisCommandsTest2.class);  @GET  @Produces(MediaType.TEXT_PLAIN)  public void hello() throws InterruptedException {    var vertx = Vertx.vertx();    final RedisOptions options = new RedisOptions()        .addConnectionString("redis://127.0.0.1:7000")        .addConnectionString("redis://127.0.0.1:7001")        .addConnectionString("redis://127.0.0.1:7002");    Redis.createClient(vertx, options)        .connect()        .subscribe().with(conn -> {          conn.send(Request.cmd(Command.GET).arg("KEY1"))              .subscribe().with(response -> {                  System.out.println(response);              });        });  }}

This doesn't work

//application.propertiesquarkus.redis.hosts=redis://127.0.0.1:7000,redis://127.0.0.1:7001,redis://127.0.0.1:7002quarkus.redis.client-type: clusterquarkus.redis.max-pool-size: 4import io.quarkus.redis.client.reactive.ReactiveRedisClient;reactiveRedisClient.get("KEY1")    .subscribe().with(response -> {        System.out.println(response);    });

Gives this error

2021-11-12 16:40:08,059 ERROR [io.qua.mut.run.MutinyInfrastructure](vert.x-eventloop-thread-15) Mutiny had to drop the followingexception: io.vertx.core.impl.NoStackTraceThrowable: Failed to connectto all nodes of the cluster

Which digging into Vert.x show this to be the actual error

io.netty.channel.AbstractChannel$AnnotatedNoRouteToHostException: Noroute to host: /10.100.23.75:6379

Which looks similar to this error but I can't find a solution https://github.com/vert-x3/vertx-redis-client/issues/223

(I'm port forwarding from Kubernetes cluster)

The real question is why does one way work but not the other? Maybe there's some property I'm missing?


Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>