1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 使用RedisDesktopManager无法连接Redis服务器问题

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

时间:2021-10-04 01:58:55

相关推荐

使用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保护模式改为nodaemonizeprotected-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

成功启动

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。