org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 192.168.36.129:6379
如果你的springboot连接redis异常跟我一样,也是无法连接,请往下接着看。
一、 查看application资源文件的host是否写错:
二、 查看虚拟机防火墙是否关闭,我这里是 CentOS 7 ,出现图中所标代表开启。
查看指令:systemctl status firewalld
关闭指令:systemctl stop firewall
如下代表已经关闭
注意: 这里把linux防火墙永久关闭,这样后续开关电脑的时候就不会再出现防火墙的问题。
永久关闭防火墙指令:chkconfig iptables off
三、 找到redis.conf文件,这是我的redis.conf文件。需要对其进行编辑。
编辑指令:vim redis.conf
1.找到bind 127.0.0.1,把它进行注释
2.找到protected-mode yes 把它改成no。
我这里已经改过了
编辑完成后一定要重启redis
编辑完成后一定要重启redis
编辑完成后一定要重启redis
四、 如果你redis有密码的话,请把密码去掉。我这里无密码,没法做演示了。