Redis图形化管理工具Redis Desktop Manager连接Redis(CentOS)

为了更好的管理Redis的使用,常用Redis Desktop Manager来进行管理

今天测试的时候发现连接不上,就开始一点点找问题。

1、要注释掉redis.conf文件里的默认IP

################################## NETWORK #####################################

# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.
#
# Examples:
#
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
#
# ~~~ WARNING ~~~ If the computer running Redis is directly exposed to the
# internet, binding to all the interfaces is dangerous and will expose the
# instance to everybody on the internet. So by default we uncomment the
# following bind directive, that will force Redis to listen only into
# the IPv4 lookback interface address (this means Redis will be able to
# accept connections only from clients running into the same computer it
# is running).
#
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
## 首先注释掉IP
# bind 127.0.0.1

2、设置Redis密码

[root@localhost redis]# ./bin/redis-cli 
127.0.0.1:6379> config set requirepass "123456"
OK
127.0.0.1:6379> auth 123456
OK

退出后再重新通过密码登录

[root@localhost redis]# ./bin/redis-cli -h 127.0.0.1 -p 6379 -a 123456

3、Windows界面执行cmd

一、如果提示“telnet不是内部或外部命令”,请点击这里

二、如果返回的结果是一片乌黑,那么请跳过这个步骤

三、如果返回的结果如下↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

C:\Users\Administrator.000>telnet 192.168.1.100 6379
正在连接192.168.1.100...无法打开到主机的连接。 在端口 6379: 连接失败

那么继续跟着我走,回到CentOS,执行以下命令

## 如果返回 no 则表示6379端口未开启
[root@localhost ~]# firewall-cmd --query-port=6379/tcp
no
## 未开启则执行以下命令
[root@localhost ~]# firewall-cmd --add-port=6379/tcp
success
## 再次查询端口是否已开启 返回yes表示已开启
[root@localhost ~]# firewall-cmd --query-port=6379/tcp
yes

4、通过Redis Desktop Manager进行连接

Redis图形化管理工具Redis Desktop Manager连接Redis(CentOS)_第1张图片

END

你可能感兴趣的:(Redis)