Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: connect timed out
上述为异常代码。
异常原因:CentOS防火墙没有关。在CentOS中防火墙默认是开启的,接下来介绍CentOS6和CentOS7两个版本关防火墙的方法。
CentOS6 | CentOS7 | |
查看防火墙状态 | /etc/init.d/iptables status | firewall-cmd --state |
开启防火墙 | /etc/init.d/iptables start | systemctl start firewalld |
关闭防火墙 | /etc/init.d/iptables stop | systemctl stop firewalld |
设置防火墙开机不启动 | chkconfig iptables off | systemctl disable firewalld |
结论:只要把防火墙关了,异常也就解决了。