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開機啓動
困擾了我好久 但是我之前好像是使用代碼關閉了我的防火牆的。。。。