RedisDesktopManager无法远程连接Redis解决方法

Linux环境:ubuntu16.04
Redis服务端版本:3.2.6 
Redis客户端下载链接:https://redisdesktop.com/download

Ubuntu16.04安装Redis教程,可参考我上篇文章:Ubuntu 16.04下Redis集群部署 
Redis-3.2.6官网tar.gz下载地址:wget http://download.redis.io/releases/redis-3.2.6.tar.gz

下载RedisDesktopManager客户端,输入服务器IP地址,端口(缺省值:6379);点击 “连接测试” 按钮测试连接,连接失败!

链接失败

什么问题呢?原因是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 ?        00:00:20 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server 127.0.0.1:7001 [cluster]
wl        12047   1416  0 10:50 ?        00:00:20 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server 127.0.0.1:7000 [cluster]
wl        12048   1416  0 10:50 ?        00:00:20 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server 127.0.0.1:7004 [cluster]
wl        12049   1416  0 10:50 ?        00:00:20 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server 127.0.0.1:7002 [cluster]
wl        12050   1416  0 10:50 ?        00:00:20 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server 127.0.0.1:7003 [cluster]
wl        12059   1416  0 10:50 ?        00:00:20 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server 127.0.0.1:7005 [cluster]
wl        14070   8680  0 13:52 pts/21   00:00:00 grep --color=auto redis

把集群的redis全部kill命令全部kill掉,问题解决:编辑redis.conf配置文件;注释掉61行本地链接限制以及80行配置修改为no

61 # bind 127.0.0.1 
80 protected-mode no

读取最新配置文件并重启,查看Redis进程情况!都开放IP链接权限了,怎么还是127.0.0.1:6379!!再查看进程情况:

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 ?        00:00:00 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server *:7000 [cluster]
wl        14201   1416  0 14:00 ?        00:00:00 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server *:7002 [cluster]
wl        14202   1416  0 14:00 ?        00:00:00 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server *:7001 [cluster]
wl        14205   1416  0 14:00 ?        00:00:00 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server *:7004 [cluster]
wl        14207   1416  0 14:00 ?        00:00:00 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server *:7003 [cluster]
wl        14211   1416  0 14:00 ?        00:00:00 /home/wl/hproj/redis-3.0/redis-3.2.6/src/redis-server *:7005 [cluster]
wl        14225   8680  0 14:01 pts/21   00:00:00 grep --color=auto redis

哇塞,*.7000,这意味着已经成功开放IP访问权限了。万事俱备,只欠点击RedisDesktopManager客户端测试链接按钮了。 

防火墙问题

[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         
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    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:6379 
10   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 服务器成功”,问题解决了。


点击 "好" 按钮,进行操作,出现如下:


参考文章:http://blog.csdn.net/qq_19260029/article/details/77920423

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值