Redis持久化从rdb切换到aof

要求:不重启redis的情况下,将RDB数据切换到AOF数据中

准备,配置文件已支持RDB持久化

port 6379
daemonize yes
pidfile /data/6379/redis.pid
loglevel notice
logfile "/data/6379/redis.log"
protected-mode yes
# RDB配置
dir /data/6379
dbfilename dbmp.rdb
save 900 1
save 300 10
save 60 10000

操作

# 临时切换到AOF模式
127.0.0.1:6379> config set appendonly yes
OK

# 保存
127.0.0.1:6379> config set save ""
OK

# 修改配置文件
port 6379
daemonize yes
pidfile /data/6379/redis.pid
loglevel notice
logfile "/data/6379/redis.log"
protected-mode yes
# RDB配置
dir /data/6379
dbfilename dbmp.rdb
save 900 1
save 300 10
save 60 10000

# AOF配置
appendonly yes
appendfsync everysec
原文地址:https://www.cnblogs.com/st-st/p/10274201.html