1.修改bind
原来:bind 127.0.0.1,代表本地回环地址,访问redis服务只能通过本机的客户端连接,而无法通过远程连接。
修改为:bind 0.0.0.0或者注释掉,这样就能接受所有来自于可用网络接口的连接。
2.修改protected mode
原来:protected mode yes保护模式,只允许本地链接。
修改为:protected mode no
改完之后,试了一下,依旧连不上,最后发现,linux中要关防火墙的。
使用命令:
systemctl stop firewalld永久关闭防火墙
将防火墙永久关闭,之后就可以连接上了。
其他关于防火墙的命令:
systemctl stop firewalld暂时关闭防火墙
systemctl status firewalld查看防火墙状态
systemctl enable firewalld重启防火墙
systemctl start firewalld启动防火墙