redis连接错误
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: connect timed out
第一种情况,启动redis时加载redis.conf文件中,bind 127.0.0.1改为bind 0.0.0.0,或者直接将其注掉#bind …
第二种情况,linux防火墙没有关闭,我的是centos7,执行以下命令
systemctl status firewalld.service
如果Active: active(running)就说明防火墙是开启的,此时我们就需要将其关闭
systemctl stop firewalld.service
接下来再次查看防火墙运行状态
此时我们的防火墙就已经关闭了,不出意外的话应该就能连接上了