Jedis无法连接centOS7上的redis

通过查看资料无法连接基本是两个原因:

1)redis.conf中的bind配置,bind的默认是 127.0.0.1 只可本机访问,我们改为 bind 0.0.0.0 即所有地址均可访问。

 2)centOS有防火墙,没有开放6379端口

centOS6关闭防火墙命令:sevice iptables stop

centOS7关闭防火墙命令:systemctl stop firewalld.service #停止

centOS7禁止firewall开机启动命令:firewall systemctl disable firewalld.service

如果是修改防火墙规则,可以修改:/etc/sysconfig/iptables文件

OK

 

原文地址:https://www.cnblogs.com/xdyixia/p/9057019.html