redis.conf中的no-appendfsync-on-rewrite
默认值为no,表示在重写AOF文件或RDB文件时阻塞fsync。

如果重写AOF或RDB文件时长过长,则在日志中可以看到如下信息:
Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.

严重时会导致该节点被判断为fail,从而触发主从切换,建议尽可能将配置项“appendfsync”的值设置为“no”。相关源代码(以REdis-5.0.4为例):

void flushAppendOnlyFile(int force) { // aof.c:331。。。。。。/* Don't fsync if no-appendfsync-on-rewrite* is set to yes and there are* children doing I/O in the background. */// no-appendfsync-on-rewrite值为yes,// 并且存在AOF或RDB进程时,直接返回而不调用fsync。if (server.aof_no_fsync_on_rewrite &&(server.aof_child_pid != -1 ||server.rdb_child_pid != -1))return;。。。。。。
}int rewriteAppendOnlyFileBackground() { // aof.c:1532。。。。。。childpid = fork();。。。。。。server.aof_child_pid = childpid;。。。。。。
}int rdbSaveBackground( // rdb.c:1282char *filename,rdbSaveInfo *rsi) {。。。。。。childpid = fork();。。。。。。server.rdb_child_pid = childpid;。。。。。。
}

22301:M 19 Apr 2019 20:49:39.391 * Starting automatic rewriting of AOF on 100% growth
22301:M 19 Apr 2019 20:49:39.520 * Background append only file rewriting started by pid 38549
22301:M 19 Apr 2019 20:49:59.080 * Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.
22301:M 19 Apr 2019 20:50:32.008 * Background AOF buffer size: 80 MB
22301:M 19 Apr 2019 20:50:47.406 * AOF rewrite child asks to stop sending diffs.
38549:C 19 Apr 2019 20:50:47.406 * Parent agreed to stop sending diffs. Finalizing AOF...
38549:C 19 Apr 2019 20:50:47.406 * Concatenating 647.71 MB of AOF diff received from parent.
38549:C 19 Apr 2019 20:50:53.097 * SYNC append only file rewrite performed
38549:C 19 Apr 2019 20:50:53.248 * AOF rewrite: 3998 MB of memory used by copy-on-write
22301:M 19 Apr 2019 20:50:53.975 * Background AOF rewrite terminated with success
22301:M 19 Apr 2019 20:50:54.030 * Residual parent diff successfully flushed to the rewritten AOF (69.97 MB)
22301:M 19 Apr 2019 20:50:54.214 * Background AOF rewrite finished successfully
22301:M 19 Apr 2019 20:51:30.085 * Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.
22301:M 19 Apr 2019 20:51:54.071 * Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.
22301:M 19 Apr 2019 20:52:23.040 * Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.
22301:M 19 Apr 2019 20:53:12.043 * Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.
22301:M 19 Apr 2019 20:55:06.226 * Marking node 720a9ead7beb61042fd56a873deec6b2cb0daec5 as failing (quorum reached).
22301:M 19 Apr 2019 20:55:06.226 # Cluster state changed: fail
22301:M 19 Apr 2019 20:55:38.186 * Clear FAIL state for node 720a9ead7beb61042fd56a873deec6b2cb0daec5: is reachable again and nobody is serving its slots after some time.
22301:M 19 Apr 2019 20:55:38.186 # Cluster state changed: ok
22301:M 19 Apr 2019 20:55:44.322 * FAIL message received from 252b3bb2f902bc81926c8ae04b6eefa8c3133bd4 about 1d5315824f9ce14f3076ff04c7330590b942efb8
22301:M 19 Apr 2019 20:55:44.322 # Cluster state changed: fail

REdis Asynchronous AOF fsync is taking too long相关推荐

  1. asynchronous aof fsync is taking too long (disk is busy?)

    一.背景 线上redis的监控数据不太好看,领导觉得看看能不能优化下,分析下什么情况,于是就..... 二.现象 看到redis日志里面一堆这个,于是就开始了分析排查 先放一张前后对比图吧 三.排查 ...

  2. Redis的AOF日志

    如果 Redis 每执行一条写操作命令,就把该命令以追加的方式写入到一个文件里,然后重启 Redis 的时候,先去读取这个文件里的命令,并且执行它,这不就相当于恢复了缓存数据了吗? 这种保存写操作命令 ...

  3. redis rdb aof区别_理解Redis的持久化机制:RDB和AOF

    什么是Redis持久化? Redis作为一个键值对内存数据库(NoSQL),数据都存储在内存当中,在处理客户端请求时,所有操作都在内存当中进行,如下所示: 这样做有什么问题呢? 注 意 文末有:362 ...

  4. redis rdb aof区别_聊一聊RDB、AOF在redis持久化里的底层原理

    什么是Redis持久化? Redis作为一个键值对内存数据库(NoSQL),数据都存储在内存当中,在处理客户端请求时,所有操作都在内存当中进行,如下所示: 这样做有什么问题呢? 其实,只要稍微有点计算 ...

  5. redis rdb aof区别_10分钟彻底理解Redis的持久化机制:RDB和AOF

    点击上方"Java知音",选择"置顶公众号" 技术文章第一时间送达! 作者:张君鸿 juejin.im/post/5d09a9ff51882577eb133aa ...

  6. Redis的AOF持久化的实现

    Redis 分别提供了 RDB 和 AOF 两种持久化机制: RDB 将数据库的快照(snapshot)以二进制的方式保存到磁盘中. AOF 则以协议文本的方式,将所有对数据库进行过写入的命令(及其参 ...

  7. redis rdb aof区别_Redis的持久化机制:RDB和AOF

    什么是Redis持久化? Redis作为一个键值对内存数据库(NoSQL),数据都存储在内存当中,在处理客户端请求时,所有操作都在内存当中进行,如下所示: 对于只把Redis当缓存来用的项目来说,数据 ...

  8. 第五章:Redis持久化-AOF持久化

    AOF持久化 AOF全称append only file持久化:以独立日志的方式记录每次写命令,重启时再重新执行AOF文件中的命令达到恢复数据的目的: AOF主要作用是解决了数据实时持久化的问题: 使 ...

  9. redis持久化--AOF(九)

    AOF(Append Only File): 是什么:以日志的形式来记录每个写操作,将Redis执行过的所有写指令记录下来(读操作不记录),只许追加文件但不可以改写文件,redis启动之初会读取该文件 ...

最新文章

  1. 解析gui-config.json出差_LUA解析json小demo
  2. My97 DatePicker日历控件在火狐或IE下打不开
  3. Spring基于配置方式实现自定义条件装配
  4. Shell(4)——测试test、[]、逻辑、||文件-f、-d、-x、-eq、-gt、-ge、-lt、-le、-ne
  5. 微软CEO纳德拉恢弘计划:让开发者始终忘不了微软
  6. CF1548A Web of Lies
  7. python网络爬虫系列(五)——数据提取 jsonpath模块
  8. 团队项目—第二阶段第三天
  9. 开博客第一天!!来几句鸡汤
  10. 驰骋开源软件一体化产品线,工作流程引擎,OA系统,即时通讯,单点登陆。
  11. JAVA与C当中基本数据类型和基本运算符的区别
  12. taro Button按钮组件
  13. shell 删除simatic_卸载西门子软件.doc
  14. 1024程序员节最新福利之2018最全大数据资料集合
  15. 项目答辩演讲稿(详细原文)
  16. VirusTotal智能搜索安卓样本示例
  17. AVFoundation(一)
  18. 根据身高体重计算BMI指数 - scala
  19. 哺乳时宝宝一边吃奶,另一边却自动流出来,这是怎么回事?
  20. 修改电量android,安卓手机端修改电池电量图标的教程

热门文章

  1. linux pstree命令
  2. html input dropdown,选择下拉插件-Dropdown.js
  3. 【git】warning: adding embedded git repository: v_project
  4. 如何进行在线教育系统软件平台开发?开发成本有多少
  5. java原生126邮箱发送邮件代码实现
  6. kubernetes部署高可用Harbor
  7. 现代信号处理——AR模型谱估计
  8. python coroutine_python coroutine
  9. 音视频编解码: 比特率 码率
  10. 34枚金币时间管理法