使用RedisDesktopManager无法连接Redis服务器问题

问题:

解决办法

问题1:redis的配置文件问题

进入redis的目录
[root@redis ~]# cd /opt/apps/redis/   opt apps 是自己创建的文件夹(用于安装redis)
使用vim进入配置文件的修改
[root@redis redis]# vim redis.conf

使用vim编辑器修改bin目录中的redis.conf文件,修改如下三项

bind                     # bind 127.0.0.1 ::1  要注释掉  
protected-mode         protected-mode保护模式改为no
daemonize                protected-mode保护模式改为no
第一项:# bind 127.0.0.1 ::1
################################## NETWORK #####################################

# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all available network interfaces on the host machine.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
# Each address can be prefixed by "-", which means that redis will not fail to
# start if the address is not available. Being not available only refers to
# addresses that does not correspond to any network interface. Addresses that
# are already in use will always fail, and unsupported protocols will always BE
# silently skipped.
#可以绑定多个ip来连接redis服务端
# Examples:
#
# bind 192.168.1.100 10.0.0.1     # listens on two specific IPv4 addresses
//这个相当于只绑定在服务端本地,也就是说只能在服务端连接redis,进行操作  所以我们要把这个注释掉
# bind 127.0.0.1 ::1              # listens on loopback IPv4 and IPv6
# bind * -::*                     # like the default, all available interfaces
第二项:protected-mode no
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured.
#protected-mode yes 默认保护模式是开启的。其只允许本机的客户端访问,即只允许自己访问自己。但生产中应该关闭,以确保其它客户端可以连接 Redis。
protected-mode no     #把这里面的保护模式yes改成no
第三项daemonize yes

该配置可以控制 Redis 启动是否采用守护进程方式,即是否是后台启动。yes 是采用后台启动。

################################# GENERAL #####################################

# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# When Redis is supervised by upstart or systemd, this parameter has no impact.
daemonize  yes

问题2 防火墙没有打开6379的端口

第一步:查看VM虚拟机的IP

查看命令是ip addr或是ifconfig

ip addr

ifconfig

第二步 :,测试端口是否畅通

返回Windows,开启cmd,通过telnet命令,测试端口是否畅通(这一步连接不能就ping一下也可以)

如果连接不通:执行以下操作 显示如下

打开控制面板-程序-启动或关闭Windows功能

Telnet客户端”默认是关闭状态;把前面的框打勾

第三步 开启6379端口

如果连接失败,表示CentOS的6379端口没有开启 ping也不行的话


首先输入firewall-cmd --query-port=6379/tcp,
如果返回结果为no,那么证明6379端口确实没有开启。
接着输入
firewall-cmd --add-port=6379/tcp,将6379端口开启,返回success。
最后然后再执行firewall-cmd --query-port=6379/tcp,返回yes,证明端口已经成功开启

开启端口成功之后再用cmd命令重复上述telnet命令一遍,出现小黑框闪烁一下说明连接没有问题。

(这里面如果telnet命令不通 ping通也是可以的)

第四步 开启redis desktop manager(可视化工具)

备注:提个醒在云服务器上安装redis最好设置密码

设置密码和绑定ip,二选一即可,否则redis处于保护模式,只能本虚拟机访问

绑定ip:# bind 127.0.0.1 ::1

关闭保护模式:protected-mode no

成功启动

  • 9
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 17
    评论
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值