当前位置 主页 > 服务器问题 > Linux/apache问题 >

    RedisDesktopManager无法远程连接Redis的完美解决方法

    栏目:Linux/apache问题 时间:2019-10-19 12:27

    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 ?        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