网站个人备案流程,网站建设公司网站源码,在附近找工作,jeecms可以做网站卖吗概述 由于最近客户需要解决redis版本升级问题#xff0c;故而全网寻找安全版本#xff0c;redis7.4.x版本求而为果#xff0c;只能自己编译了。
截止发文时间2025-02-12 最新稳定版的redis版本号为7.4.2
Security fixes
(CVE-2024-46981) Lua script commands may lead t…概述 由于最近客户需要解决redis版本升级问题故而全网寻找安全版本redis7.4.x版本求而为果只能自己编译了。
截止发文时间2025-02-12 最新稳定版的redis版本号为7.4.2
Security fixes
(CVE-2024-46981) Lua script commands may lead to remote code execution(CVE-2024-51741) Denial-of-service due to malformed ACL selectors
Bug fixes
#13627 Crash on module memory defragmentation#13338 Streams: XINFO lag field is wrong when tombstone is after the last_id of the consume group#13473 Streams: XTRIM does not update the maximal tombstone, leading to an incorrect lag#13470 INFO after HDEL show wrong number of hash keys with expiration#13476 Fix a race condition in the cache_memory of functionsLibCtx#13626 Memory leak on failed RDB loading#13539 Hash: fix key ref for a hash that no longer has fields with expiration on RENAME/MOVE/SWAPDB/RESTORE#13443 Cluster: crash when loading cluster config#13422 Cluster: CLUSTER SHARDS returns empty array#13465 Cluster: incompatibility with older node versions#13608 Cluster: SORT ... GET #: incorrect error message 版本选择
指导修复方案参考这有助于选择正确的版本。
云数据库 Redis® 升级实例版本-操作指南-文档中心-腾讯云 实操步骤
1. 准备宿主环境
寻找一个干净的编译环境博主这里选择虚拟机(vmware 16.2.5 build-20904516)
安装Centos7(CentOS-7-x86_64-Minimal-1804)
其他版本也可最好根据你需要的系统选择。
2. 准备打包环境 sudo yum update -y sudo yum groupinstall Development Tools -y sudo yum install wget gcc make tcl rpm-build redhat-rpm-config -y 3. 获取最新稳定版的源代码
(如果github直连存在问题请自行魔法上网) wget https://github.com/redis/redis/archive/refs/tags/redis-7.4.2.tar.gz tar -xzf redis-7.4.2.tar.gz cd redis-7.4.2 3. 编译 make (可选/推荐) 测试 make test 4. 安装到临时目录 mkdir -p /tmp/redis-install make PREFIX/tmp/redis-install install 5. 创建RPM约束文件 (1) 创建 RPM 构建目录结构 RPM 构建需要特定的目录结构 mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo %_topdir %(echo $HOME)/rpmbuild ~/.rpmmacros 6. 增加配置文件 mkdir /tmp/redis-install/etc cp redis-7.4.2/redis.conf /tmp/redis-install/etc/ 这里的redis.conf文件可以根据你的需要先把它修改下基本上就是如下的内容。
requirepass xxxx 是单机加密码的部分这里我给和谐掉了。
bind 0.0.0.0 ::1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /var/log/redis/redis.log
databases 16
always-show-logo no
set-proc-title yes
proc-title-template {title} {listen-addr} {server-mode}
locale-collate
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
rdb-del-sync-files no
dir /var/lib/redis
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync yes
repl-diskless-sync-delay 5
repl-diskless-sync-max-replicas 0
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
requirepass 你的密码
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
lazyfree-lazy-user-flush no
oom-score-adj no
oom-score-adj-values 0 200 800
disable-thp yes
appendonly no
appendfilename appendonly.aof
appenddirname appendonlydir
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
aof-timestamp-enabled noslowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events
hash-max-listpack-entries 512
hash-max-listpack-value 64
list-max-listpack-size -2
list-compress-depth 0
set-max-intset-entries 512
set-max-listpack-entries 128
set-max-listpack-value 64
zset-max-listpack-entries 128
zset-max-listpack-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes7. 准备规范文件 (SPEC) 创建一个规范文件例如 redis.spec) vim ~/rpmbuild/SPECS/redis.spec
(如果想添加编译者的名字和联系方式可以在配置中给出)
内容如下: Name: redis Version: 7.4.2 Release: 1%{?dist} Summary: An advanced key-value store License: BSD URL: https://redis.io/ Source0: redis-%{version}.tar.gz BuildRequires: gcc make tcl Requires: tcl %description Redis is an open-source, in-memory data structure store, used as a database, cache, and message broker. %prep %setup -q %build make %install rm -rf %{buildroot} mkdir -p %{buildroot}/usr/local/bin mkdir -p %{buildroot}/etc mkdir -p %{buildroot}/var/lib/redis mkdir -p %{buildroot}/lib/systemd/system # 安装二进制文件 install -m 755 src/redis-server %{buildroot}/usr/local/bin/ install -m 755 src/redis-cli %{buildroot}/usr/local/bin/ install -m 755 src/redis-benchmark %{buildroot}/usr/local/bin/ install -m 755 src/redis-check-aof %{buildroot}/usr/local/bin/ install -m 755 src/redis-check-rdb %{buildroot}/usr/local/bin/ # 安装配置文件 install -m 644 redis.conf %{buildroot}/etc/redis.conf # 安装 systemd 服务文件 install -m 644 redis.service %{buildroot}/lib/systemd/system/redis.service %pre # 检查并备份旧版本的配置文件和数据目录 if [ -f /etc/redis.conf ]; then # 备份配置文件 cp /etc/redis.conf /etc/redis.conf.backup.%{version} echo Old redis.conf backed up to /etc/redis.conf.backup.%{version} fi if [ -d /var/lib/redis ]; then # 备份数据目录 tar -czf /var/lib/redis_backup_%{version}.tar.gz -C /var/lib redis echo Old Redis data directory backed up to /var/lib/redis_backup_%{version}.tar.gz fi # 删除旧版本的服务文件如果存在 if [ -f /lib/systemd/system/redis.service ]; then rm -f /lib/systemd/system/redis.service systemctl daemon-reload echo Old redis.service removed fi %post # 创建 Redis 用户和组如果不存在 groupadd -f -r redis || : # 创建组如果已存在则忽略错误 useradd -r -g redis -s /bin/false -M redis || : # 创建用户指定组禁用登录 # 确保数据目录存在并设置权限 mkdir -p /var/lib/redis chown -R redis:redis /var/lib/redis chmod 700 /var/lib/redis # 增加一些补充动作 chown redis:redis /etc/redis.conf chown -R redis:redis /var/lib/redis/ mkdir -p /var/log/redis/ touch /var/log/redis/redis.log chown -R redis:redis /var/log/redis/ touch /var/run/redis_6379.pid chown redis:redis /var/run/redis_6379.pid # 重新加载 systemd 配置并启用 Redis 服务 systemctl daemon-reload systemctl enable redis || : # 启用服务忽略可能的错误 systemctl start redis || : # 尝试启动服务 %preun if [ $1 -eq 0 ]; then # 卸载时停止并禁用 Redis 服务 systemctl stop redis || : # 停止服务忽略可能的错误 systemctl disable redis || : # 禁用服务忽略可能的错误 # 删除 Redis 服务文件 rm -f /lib/systemd/system/redis.service systemctl daemon-reload || : # 重新加载 systemd 配置 # 删除 Redis 用户和组可选 userdel -r redis || : # 删除用户及其主目录忽略可能的错误 groupdel redis || : # 删除组忽略可能的错误 fi %files /usr/local/bin/redis-server /usr/local/bin/redis-cli /usr/local/bin/redis-benchmark /usr/local/bin/redis-check-aof /usr/local/bin/redis-check-rdb /etc/redis.conf /lib/systemd/system/redis.service /var/lib/redis/ %changelog * Tue Feb 11 2025 你的名字 你的邮箱 - 7.4.2-1 - Initial package for Redis 7.4.2 with configuration file, Tcl dependency, and systemd integration. - Added backup functionality in %pre script. 在你的编译好的文件中添加 redis.serice, 内容如下:
[Unit]
DescriptionRedis In-Memory Data Store
Afternetwork.target[Service]
Userredis
Groupredis
ExecStart/usr/local/bin/redis-server /etc/redis.conf
ExecStop/usr/local/bin/redis-cli shutdown
Restartalways[Install]
WantedBymulti-user.target 8. 打包源码成压缩包 将 Redis 源码打包为 .tar.gz 文件并将其移动到 SOURCES 目录 tar -czf ~/rpmbuild/SOURCES/redis-7.4.2.tar.gz redis-7.4.2/ 9. 构建RPM包 使用 rpmbuild 命令构建 RPM 包 rpmbuild -ba ~/rpmbuild/SPECS/redis.spec 基本上到这里就结束了如果环境一致操作顺畅的话你将会在 /root/rpmbuild/RPMS/x86_64 下得到你想要的。
图没截回头想起来再补吧。