RedisDesktopManager无法远程连接Redis的完美解决方法
Linux环境:ubuntu16.04
Redis服务端版本:3.2.6
Redis客户端下载链接:https://redisdesktop.com/download
省略Linux系统安装Redis教程,网上安装教程很多;建议用tar.gz包安装
Redis官网tar.gz下载地址:wget http://xiazai.jb51.net/201803/yuanma/redis-3.2.6(jb51.net).rar
下载RedisDesktopManager客户端,输入服务器IP地址,端口(缺省值:6379);点击Test Connection按钮测试连接,连接失败!
什么问题呢?原因是Redis默认只支持本地链接,输入进程命令查看得知(127.0.0.1:7000)
wl@ubuntu:~/hproj/redis-3.0/redis-3.2.6/src$ ./redis-cli shutdown
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Could not connect to Redis at 127.0.0.1:6379: Connection refused
wl@ubuntu:~/hproj/redis-3.0/redis-3.2.6/src$ ps -ef | grep redis
wl 12046 1416 0 10:50 "htmlcode">wl@ubuntu:~/hproj/redis-3.0/cluster$ ./redis-start.sh wl@ubuntu:~/hproj/redis-3.0/cluster$ ps -ef | grep redis wl 14200 1416 0 14:00 "htmlcode">[root@Karle src]# service iptables status 表格:filter Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080 6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80 7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3306 8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:15672 9 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
编辑Linux防火墙
[root@Karle src]# vi /etc/sysconfig/iptables
加入防火墙规则
:-A INPUT -m state –state NEW -m tcp -p tcp –dport 6379 -j ACCEPT
[root@Karle src]# service iptables status表格:filter
Chain INPUT (policy ACCEPT) num target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3306 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:15672 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:6379 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited重启Linux防火墙
[root@Karle src]# service iptables restart点击 “测试连接” 按钮测试连接,显示 “连接Redis 服务器成功”,问题解决了。
总结
以上所述是小编给大家介绍的RedisDesktopManager无法远程连接Redis解决方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
下一篇:Redis中3种特殊的数据类型(BitMap、Geo和HyperLogLog)