liunx centos9中安装Redis数据库,并在win10中连接redis图文详解

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

首先我们去Redis的官网点击download下载tar的压缩包
https://redis.io/download/#redis-downloads
liunx centos9中安装Redis数据库
用xftp将安装包上传到你的liunx服务器本地地址在这里插入图片描述
解压
tar -xvf /root/redis-7.0.8.tar.gz
cd进入你刚才解压的文件夹中
cd /root/redis-7.0.8
执行make进行编译
编译·完成后cd进入刚才安装好的src文件夹中
cd /root/redis-7.0.8/src
然后./redis-server启动redis服务
在这里插入图片描述
虽然redis目前是成功启动但是如果是上图那样的话我们是无法继续进行操作所以需要修改一下配置用xftp找到redis.conf这个文件
在这里插入图片描述
ctrl+F搜索daemonize no将no改成yes
然后再保存文件重启服务后使用

./redis-server …/redis.conf
命令启动
在这里插入图片描述
使用./redis-cli与 redis 服务交互出现本地端口号即代表连接成功
在这里插入图片描述
然后我们随便定义一个键能够看到返回值就代表安装成功
在这里插入图片描述
我们需要用到图形化管理这里我建议用RedisStudio可以自行搜索一下但是目前为止redis数据库我们是无法在win10中进行连接
在这里插入图片描述
找到redis.conf
将这里的127.0.0.1前面加个#注释掉

同时关闭保护模式将之前的yes改成protected-mode no
然后保存退出重新启动一下redis

#bind 0.0.0.0

# By default, outgoing connections (from replica to master, from Sentinel to
# instances, cluster bus, etc.) are not bound to a specific local address. In
# most cases, this means the operating system will handle that based on routing
# and the interface through which the connection goes out.
#
# Using bind-source-addr it is possible to configure a specific address to bind
# to, which may also affect how the connection gets routed.
#
# Example:
#
# bind-source-addr 10.0.0.1

# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
#
# When protected mode is on and the default user has no password, the server
# only accepts local connections from the IPv4 address (127.0.0.1), IPv6 address
# (::1) or Unix domain sockets.
#
# By default protected mode is enabled. You should disable it only if
# you are sure you want clients from other hosts to connect to Redis
# even if no authentication is configured.
protected-mode no

修改密码
在这里插入图片描述

用ps检查redis进程
ps -ef|grep redis
出现*表示都可以连接
在这里插入图片描述
然后我们再关闭防火墙
systemctl stop firewalld
我们打开RedisStudio输入你的虚拟机ip地址端口号和密码就会出现绿色连接成功

在这里插入图片描述
点击Data就会出现一个我们刚开始输入的test的value值
在这里插入图片描述

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6