Redis-多种方法安装部署

举报
yd_299763254 发表于 2026/10/14 08:44:44 2026/10/14
【摘要】 yum 安装1.安装扩展源yum -y install epel-release2.安装Redisyum -y install redis3.启动Redissystemctl start redissystemctl enable redis4.连接Redis这里的redis也和其他软件一样,开始是没有密码,就算有密码也可以这样连接,只是在执行命令的会提示认证失败。[root@localho...

yum 安装

1.安装扩展源
yum -y install epel-release
2.安装Redis
yum -y install redis
3.启动Redis
systemctl start redis
systemctl enable redis
4.连接Redis

这里的redis也和其他软件一样,开始是没有密码,就算有密码也可以这样连接,只是在执行命令的会提示认证失败。
[root@localhost ~]# redis-cli
127.0.0.1:6379> info

Server

redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7897e7d0e13773f
redis_mode:standalone
os:Linux 3.10.0-1160.el7.x86_64 x86_64
#省略部分信息

编译安装

1.下载软件包
自行官网下载对应版本
2.解压&编译
由于centos7系列,再加上上使用的Redis软件版本比较新,所以编译过程我这里就略过了,有兴趣可以去我的历史文章,如何编译:Linux软件安装。
tar xvf redis-stable.tar.gz
cd redis-stable
编译完成以后实际上我们就是获取下面几个二进制包。

3.启动Redis
当然这里是前台启动,甚至都没有指定配置配置。如果是指定配置文件启动则是下面的方式。

redis-server redis.conf
[root@localhost src]# redis-server
7575:C 09 Jan 2026 00:31:50.967 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
7575:C 09 Jan 2026 00:31:50.968 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7575:C 09 Jan 2026 00:31:50.968 * Redis version=8.3.240, bits=64, commit=00000000, modified=1, pid=7575, just started
7575:C 09 Jan 2026 00:31:50.968 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
7575:M 09 Jan 2026 00:31:50.968 * Increased maximum number of open files to 10032 (it was originally set to 1024).
7575:M 09 Jan 2026 00:31:50.968 * monotonic clock: POSIX clock_gettime
.
.-__ ''-._ _.- . . ‘’-._ Redis Open Source
.- .-```. ```\/ _.,_ ''-._ 8.3.240 (00000000/1) 64 bit ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.-.|'_.-'| Port: 6379 | -. ._ / _.-' | PID: 7575 -._ -._ -./ .-’ .-’
|-._-.
-.__.-' _.-'_.-'| | -.
-._ _.-'_.-' | https://redis.io -._ -._-..-'.-’ .-’
|-._-.
-.__.-' _.-'_.-'| | -.
-._ _.-'_.-' | -._ -._-.
.-‘_.-’ _.-’
-._ -..-’ _.-’
-._ _.-' -.
.-’

7575:M 09 Jan 2026 00:31:50.969 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7575:M 09 Jan 2026 00:31:50.969 * Server initialized
7575:M 09 Jan 2026 00:31:50.969 * Ready to accept connections tcp
4.连接redis

[root@localhost src]# redis-cli
127.0.0.1:6379> info

Server

redis_version:8.3.240
redis_git_sha1:00000000
redis_git_dirty:1
redis_build_id:fcebfdad2f0b4098
redis_mode:standalon

【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0)

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。