redis版本: redis-5.0.2
Linux版本:CenterOS 7
安装参考:https://www.cnblogs.com/feinian/p/9825232.html
问题描述:
- 安装redis完成,并修改了配置。
- 把bind 127.0.0.1 修改成bind 0.0.0.0 。 (目的:允许远程连接访问)
- 开启了守护进程 :把daemonize no 改为 daemonize yes 。
- 使用./redis-server redis.config 命令成功运行。
- 使用./redis-cli 命令成功进入客户端。
- 并且打开了防火墙,为6379端口放行
- iptables -A INPUT -p tcp --dport 6379 -j ACCEPT
- iptables -A OUTPUT -p tcp --sport 6379 -j ACCEPT
- iptables -L -n (查看端口是否写入)
- service iptables save 保存
- 并且成功保存。尝试使用windows中的 redis Desktop Manager 连接。
- 第一次尝试连接, redis Desktop Manager日志信息
2018-12-20 11:47:51 : Init app log 2018-12-20 11:48:36 : Connection: Cancel running commands 2018-12-20 11:48:36 : Connection: Connection error: Connection timed out
2.第二次尝试连接,r依旧是上面的错误。
- 第一次尝试连接, redis Desktop Manager日志信息
6.尝试使用windows测试 ,ping IP 成功。但是依旧是第5的错误信息
7.后面使用这个解决了这个问题:
sudo systemctl stop firewalld.service #停止firewall
sudo systemctl disable firewalld.service #禁止firewall开机启动
困扰了我好久 但是我之前好像是使用代码关闭了我的防火墙的。。。。