redis升级

服务器原来使用yum安装的。可以参考下面文章

Linux---Redis安装以及配置_yum安装redis-CSDN博客

yum安装的redis版本比较旧,我们直接下载源码编译安装。

我们下载已经发布的版本

Releases · redis/redis · GitHub

1、解压

2、make

3、make install

4、修改redis.conf

复制代码
log相关, logfile对应的文件所在的文件夹一定要创建,同时保证redis的运行用户,具有修改权限
# Specify the server verbosity level.
# This can be one of:
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
# nothing (nothing is logged)
loglevel verbose

# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
#logfile /var/log/redis/redis-server.log
logfile "" 

  
bind 可以访问的用户
#bind 127.0.0.1 -::1  注释掉就代表任何人都可以访问,这里可以做访问限制

requirepass 设置密码
requirepass xxxxx

5、使用systemctl启动

这需要配置启动文件

在/etc/systemd/system中创建redis.service

复制代码
[Unit]
Description=Redis In-Memory Data Store
After=network.target

[Service]
User=redis  
Group=redis  #删除User和Group代表由root用户启动
ExecStart=/usr/local/bin/redis-server /root/software/redis-7.4.1/redis.conf
ExecStop=/usr/local/bin/redis-cli -p 6379 shutdown
Restart=on-failure
Type=simple

[Install]
WantedBy=multi-user.target

可以使用下面命令进行操作

systemctl start redis

systemctl stop redis

systemctl status redis

systemctl enable redis 开机自启动

相关推荐
考虑考虑5 小时前
数据库中的EXISTS
运维·数据库·后端
Wang's Blog5 小时前
Java框架快速入门: Spring Security+OAuth2之数据库和实体类的RBAC改造
java·数据库·spring
梦想平凡6 小时前
百游棋牌源代码开发搭建教程(十):隔离部署、备份恢复与双端验收
java·前端·javascript·数据库·源代码管理
xcLeigh7 小时前
让大模型长出手脚,自己写SQL查数据库(Function Calling初探)
数据库·人工智能·sql·时序数据库·timechoai
yume_sibai8 小时前
06-Rust Web 开发实战(Axum 框架 + 数据库 + JWT 认证 + 中间件 + 部署)
前端·数据库·rust
AugustRed9 小时前
Neo4j 图数据库原理 + 应用场景简单介绍
数据库·neo4j
Gl�ria9 小时前
Redis 高可用架构对比
数据库·redis
IpdataCloud9 小时前
高可用的IP数据接口平台有哪些?从可用性、P99延迟到离线部署的评估框架(含代码)
数据库·tcp/ip·ip
呆萌很10 小时前
MySQL 数据库和表的管理操作(命令行)
数据库·mysql
IvorySQL10 小时前
当PostgreSQL“听懂”MySQL——协议兼容层的设计与实战
数据库·人工智能·postgresql