Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.9k views
in Technique[技术] by (71.8m points)

java - Redis: Unable to connect to 192.168.42.223/<unresolved>:6379

I am trying to connect to redis in java using lettuce. Following is my code

import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;

RedisClient redisClient = RedisClient.create("redis://192.168.42.223/0");
StatefulRedisConnection<String, String> redisConnection = redisClient.connect();

I am getting following error.

Unable to connect to 192.168.42.223/<unresolved>:6379

in exception following is showing as cause (Exception e.cause)

"java.lang.IllegalStateException: RedisHandshakeHandler not registered"

What wrong am I doing?

I found that if I use older version of lettuce (3.2.Final) as following, then it works (official site is using older version https://redislabs.com/lp/redis-java/).

import com.lambdaworks.redis.*;

RedisClient redisClient = new RedisClient(RedisURI.create("redis://192.168.42.223"));
RedisConnection<String, String> connection = redisClient.connect();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...