标题: IDEA通过Jedis操作Linux上的Redis;Failed to connect to any host resolve [打印本页] 作者: 火影 时间: 2022-6-23 19:14 标题: IDEA通过Jedis操作Linux上的Redis;Failed to connect to any host resolve testPing.java
public class testPing {
public static void main(String[] args) {
Jedis jedis = new Jedis("Redis节点所在的机器的IP",6379);
System.out.println(jedis.ping());
System.out.println(jedis.keys("*"));
}
}
复制代码
出现以下错误:
Failed to connect to any host resolved for DNS name.
Suppressed: java.net.SocketTimeoutException: connect timed out
首先查看Jedis类的构造方法: