解决方法:
在Redis的配置文件redis.conf中进行配置
1、用井号(#)注释掉bind 127.0.0.1
bind 127.0.0.1意思是处于保护模式
即:链接redis 时只能通过本地localhost (127.0.0.1)来链接 而不能用网络ip(192.168…)来链接
2、设置一个密码(可选,安全)
将requirepass的注释去掉 将foobared改为自己设置的密码
3、关闭linux防火墙
CentOS 7.0默认使用的是firewall作为防火墙
直接关闭防火墙:systemctl stop firewalld.service
禁止firewall开机启动:systemctl disable firewalld.service