perf(redis): 增强持久化与优雅停止
This commit is contained in:
+11
-5
@@ -31,17 +31,25 @@ tcp-backlog 511
|
||||
replica-read-only no
|
||||
|
||||
# 设置Redis最大内存达到时的数据淘汰策略
|
||||
# noeviction:当内存达到最大限制时,Redis不会自动删除任何键,这可能导致进一步的操作失败,直到手动干预 # 当内存不足时,删除最近最少使用的键
|
||||
# 为 2GB 容器预留约 512MB,供连接缓冲区、模块、AOF 重写和 fork/COW 使用。
|
||||
# noeviction:达到数据内存上限后拒绝写入,避免淘汰队列内部键导致状态不一致。
|
||||
# maxmemory-policy allkeys-lru
|
||||
maxmemory 2gb
|
||||
maxmemory 1536mb
|
||||
maxmemory-policy noeviction
|
||||
# 设置数据库数量,这里设置为16个数据库
|
||||
databases 16
|
||||
# AOF 常规配置
|
||||
appendfsync everysec
|
||||
no-appendfsync-on-rewrite yes
|
||||
# AOF/RDB 重写期间继续 fsync,优先保证异常退出后的数据完整性。
|
||||
no-appendfsync-on-rewrite no
|
||||
auto-aof-rewrite-percentage 100
|
||||
auto-aof-rewrite-min-size 64mb
|
||||
# 自动修复意外 EOF;Redis 8.4+ 可额外截断小范围格式损坏尾部。
|
||||
aof-load-truncated yes
|
||||
aof-load-corrupt-tail-max-size 4096
|
||||
# 使用 RDB 作为 AOF 基础文件并增量刷盘,降低重写和恢复开销。
|
||||
aof-use-rdb-preamble yes
|
||||
aof-rewrite-incremental-fsync yes
|
||||
# 慢查询阈值
|
||||
slowlog-log-slower-than 10000
|
||||
slowlog-max-len 128
|
||||
@@ -67,5 +75,3 @@ list-max-ziplist-value 64
|
||||
set-max-intset-entries 512
|
||||
zset-max-ziplist-entries 128
|
||||
zset-max-ziplist-value 64
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user