关于Redis的远程连接 Connection time out 问题

redis版本: redis-5.0.2

Linux版本:CenterOS 7

安装参考:https://www.cnblogs.com/feinian/p/9825232.html

问题描述:

  1. 安装redis完成,并修改了配置。
    1. 把bind 127.0.0.1  修改成bind 0.0.0.0 。 (目的:允许远程连接访问)
    2. 开启了守护进程  :把daemonize no 改为 daemonize yes 。
  2. 使用./redis-server  redis.config  命令成功运行。
  3. 使用./redis-cli 命令成功进入客户端。
  4. 并且打开了防火墙,为6379端口放行
    1. iptables -A INPUT -p tcp --dport 6379 -j ACCEPT 
    2.  iptables -A OUTPUT -p tcp --sport 6379 -j ACCEPT
    3. iptables -L -n   (查看端口是否写入)
    4. service iptables save  保存
  5. 并且成功保存。尝试使用windows中的 redis Desktop Manager 连接。
    1. 第一次尝试连接, 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依旧是上面的错误。

6.尝试使用windows测试  ,ping  IP 成功。但是依旧是第5的错误信息

7.后面使用这个解决了这个问题: 

sudo systemctl stop firewalld.service #停止firewall 

sudo systemctl disable firewalld.service #禁止firewall开机启动

困扰了我好久 但是我之前好像是使用代码关闭了我的防火墙的。。。。

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值