Getting "Unknown Reply" while connecting GCP redis instance from jedis java client

20 Views Asked by At

I am getting the below error while trying to test the Redis memory-store GCP service. The mememory-store service works fine in GCP but I can not store any data.

I am using jedis client and when I run the below code, the connection gets established with the Redis instance but it always returns the strange character.`

JAVA Code-

JedisPool pool = new JedisPool("XXX.XX.XX.149", 6378);
    try (Jedis jedis = pool.getResource()) {
        Map<String, String> hash = new HashMap<>();
        hash.put("name", "John");
        hash.put("surname", "Smith");
        hash.put("company", "Redis");
        hash.put("age",   "29");
        jedis.hset("user-session:123", hash);
        System.out.println(jedis.hgetAll("user-session:123"));
    }

Exception -

 Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: 
 at redis.clients.jedis.Protocol.process(Protocol.java:166)
 at redis.clients.jedis.Protocol.read(Protocol.java:221)
 at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:351)
 at redis.clients.jedis.Connection.getMany(Connection.java:366)
 at redis.clients.jedis.Connection.initializeFromClientConfig(Connection.java:442)
 at redis.clients.jedis.Connection.\<init\>(Connection.java:68)
 at redis.clients.jedis.Jedis.\<init\>(Jedis.java:220)
 at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:170)
 at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:571)
 at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:298)
 at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223)
 at redis.clients.jedis.util.Pool.getResource(Pool.java:38)
 at redis.clients.jedis.JedisPool.getResource(JedisPool.java:378)
 at com.db.dbfuse.Test.callRedis(Test.java:33)
 at com.db.dbfuse.Test.main(Test.java:20)
0

There are 0 best solutions below