REdis之RDB配置问题

RDB配置:/etc/redis.conf

 save 900 1
 save 300 10
 save 60 10000
 stop-writes-on-bgsave-error no
 rdbcompression yes
 rdbchecksum yes
 repl-diskless-sync no
 aof-use-rdb-preamble no
 rdb-save-incremental-fsync yes
 影响:
 易生成REdis客户端的连接超时。
 
 建议:
 如果已经开启了AOF,可关闭RDB,即将save参数值设置为空:save "";
 或者调大save参数,人工控制save执行时间点,将save放在空闲时段,
 但问题实际仍然存在,只是影响减少,同时需要调长client与REdis的超时时长。
 如果是REdis-5.0或以上版本,可以设置配置项rdb-save-incremental-fsync值为yes,
 以降低save时的影响,但之下的版本不支持rdb-save-incremental-fsync。
 
 理由:
 在生成RDB时,易导致客户端访问超时。
 截至REdis-5.0版本,如果开启了AOF,
 在进程启动时仍然只会加载AOF文件,并不会使用RDB文件,
 所以不生成RDB也是安全的。
 
 缺点:
 AOF文件不支持重启后的增量复制(可理解为断点续复制),
 而从REdis-4.0开始RDB支持增量复制。
 在不久的将来,AOF可能也会支持重启时的增量复制。
 一个比较简单的实现AOF支持增量复制方法,
 新增命令SETREPL,在每次fsync之前写入一笔SETREPL命令,
 该命令带两个参数,一是replid,二是offset,
 这样重启回放时,可以象RDB那样恢复replid和offset,
 而只需要对REdis做小量改动。
 
 保存RDB日志示例:
 62820:M 01 Apr 18:15:57.097 * 10000 changes in 60 seconds. Saving...
 62820:M 01 Apr 18:15:57.103 * Background saving started by pid 69409
 69409:C 01 Apr 18:15:57.427 * DB saved on disk
 69409:C 01 Apr 18:15:57.433 * RDB: 2 MB of memory used by copy-on-write
 62820:M 01 Apr 18:15:57.504 * Background saving terminated with success
 
 
 62820:M 01 Apr 18:16:58.098 * 10000 changes in 60 seconds. Saving...
 62820:M 01 Apr 18:16:58.104 * Background saving started by pid 75882
 75882:C 01 Apr 18:16:58.426 * DB saved on disk
 75882:C 01 Apr 18:16:58.433 * RDB: 2 MB of memory used by copy-on-write
 62820:M 01 Apr 18:16:58.505 * Background saving terminated with success
 
 
 62820:M 01 Apr 18:17:59.104 * 10000 changes in 60 seconds. Saving...
 62820:M 01 Apr 18:17:59.110 * Background saving started by pid 82326
 82326:C 01 Apr 18:17:59.419 * DB saved on disk
 82326:C 01 Apr 18:17:59.426 * RDB: 2 MB of memory used by copy-on-write
 62820:M 01 Apr 18:17:59.510 * Background saving terminated with success
 


 window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];  

 

posted @ 2021-01-31 21:41  星火撩原  阅读(149)  评论(0编辑  收藏  举报