Java USES the following code connection redis jedis. Exceptions. JedisConnectionException: java.net.SocketTimeoutException: connect timed out
import redis.clients.jedis.Jedis;
Public class redisTest {
Public static void main (String [] args) {
Jedis Jedis=new Jedis (" ali cloud ecs server IP address ", 6379);
Jedis. Auth (" redis password ");
System. The out. Println (jedis. Ping ());
}
}
Online method are tried,
1, modify the redis. Conf file, will bind 127.0.0.1 annotation
2, close the firewall
3, shut off the protected mode
-4, ali cloud server security group opened the port 6379
Above all try not
But visualization tools RedisDesktop Manager can connect successfully, as shown in figure, can appear the Java connection timeout,
Hope leaders can help to solve
CodePudding user response:
Connect with redis - first cli?CodePudding user response: