redis持久化配置

一、什么是持久化

基础名词解释:https://www.cnblogs.com/chenliangcl/p/7240350.html

此处我是使用的AOF来做的持久化

bind 127.0.0.1
port 36379
tcp-backlog 511
timeout 0
tcp-keepalive 0
daemonize no
pidfile /var/run/redis36379.pid
loglevel notice
logfile "/mnt/logs/redis/redis36379.log"
databases 16
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump36379.rdb
dir /mnt/data/redis36379/
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100

#追加式持久化配置.每当Redis接受到会修改数据集的命令时,就会把命令追加到AOF文件里.
appendonly yes
appendfilename "appendonly36379.aof"

appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

rename-command FLUSHALL ""
rename-command CONFIG ""
rename-command EVAL ""

测试:设置一个值,然后重启redis之后,测试,是否存在,存在说明持久化ok

猜你喜欢

转载自www.cnblogs.com/tianfen/p/8926752.html