Redis可视化工具连接Redis服务器失败的完美解决

背景描述:

Redis可视化工具连接Redis服务器失败,最主要的问题在于linux对外端口没开。。。

开放对外端口指令,改完后,记得保存一下配置文件信息,然后重启一下防火墙设置(下列代码指令中有)

-A INPUT -p tcp --dport 6379 -j ACCEPT 

具体操作指令

[root@localhost bin]# vim /etc/sysconfig/iptables
[root@localhost bin]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
[root@localhost bin]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
[root@localhost bin]# iptables -L -n -v
Chain INPUT (policy ACCEPT 5 packets, 320 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 4 packets, 432 bytes)
 pkts bytes target     prot opt in     out     source               destination         
[root@localhost bin]# 

遇到redis连接不成功问题

教大家如何排查,方法如下:

1. 查看redis服务器是否启动成功

2.如果启动成功了,查看对应得端口号。查看是默认端口号启动的还是其他端口号启动的。

如果不是默认端口6379启动的话,需要更改连接设置

3.如果上述都没错的情况下,查看redis的配置文件,查看bind绑定的地址,确保和客户端保持一致

4.在解决防火墙的问题中,一定要记得保存配置文件,重启防火墙,确保配置生效

5.上述问题的步骤可以随意操作,因为不管哪个步骤有问题,都会导致连接失败


版权声明:本文为baidu_35901646原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。