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:1282
char *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. redis 持久化 AOF和 RDB 引起的生产故障

    概要       最近听开发的同事说,应用程序连接 redis 时总是抛出连接失败或超时之类的错误.通过观察在 redis 日志,发现日志中出现 "Asynchronous AOF fsyn ...

  2. Redis的AOF功能

    引言:  Redis是基于内存的数据库,同时也提供了若干持久化的方案,允许用户把内存中的数据,写入本地文件系统,以备下次重启或者当机之后继续使用.本文将描述如何基于Redis来设置AOF功能 什么是R ...

  3. Redis开启AOF导致的删库事件

    事件背景 Redis主从开启AOF,错误操作导致数据被清空. Redis主要作用:缓存.队列. 事故过程 Redis搭建了主从,持久化方式为RDB,RDB没有定时备份,且AOF都没有开启. 考虑到开启 ...

  4. Redis持久化——AOF(二)

    核心知识点: 1.AOF:以独立日志的方式记录写命令,重启时再执行命令.与RDB不同的是解决数据持久化的实时性,可以记录所有写操作. 2.AOF工作流程:写入命令.文件同步.文件重写.文件加载. 3. ...

  5. Redis持久化——AOF日志

    最新:Redis内存--内存消耗(内存都去哪了?) 最新:Redis持久化--如何选择合适的持久化方式 最新:Redis持久化--AOF日志 更多文章... 上一篇文章Redis持久化--内存快照(R ...

  6. Redis - 持久化 AOF 和 RDB

    Redis - 持久化 AOF 和 RDB AOF AOF 持久化记录服务器执行的所有写操作命令,并在服务器启动时,通过重新执行这些命令来还原数据集. AOF 文件中的命令全部以 Redis 协议的格 ...

  7. 一文了解:Redis的AOF持久化

    Redis的AOF持久化 每当Redis-Server接收到写数据时,就把命令以文本形式追加到AOF文件里,当重启Redis服务时,AOF文件里的命令会被重新执行一次,重新恢复数据.当AOF过大时将重 ...

  8. redis 配置文件aof配置

    redis 配置文件aof配置: bind 127.0.0.1 port 6379 daemonize yes dbfilename dump.rdb dir /new_renpeng/redis/ ...

  9. redis 开启AOF 持久化

    redis 开启AOF 找到redis 安装目录 打开 redis.conf  修改以下参数: appendonly  yes        (默认no,关闭)表示是否开启AOF持久化: append ...

随机推荐

  1. 关于创建String对象过程的内存分配

    String是引用数据类型 但是String实际上java给我们提供的是一个类 注意:String 全类被fianl所修饰 所以 String 又叫 字符串常量 String 的值 一旦定义 不可以改 ...

  2. 吴裕雄 python 机器学习——逻辑回归

    import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot ...

  3. nginx入门之编译安装

    nginx是什么 nginx是一个开源的,支持高性能,高并发的www服务和代理服务软件.它是一个俄罗斯人lgor sysoev开发的,作者将源代码开源出来供全球使用. nginx比它大哥apache性 ...

  4. 模型压缩,模型减枝,tf.nn.zero_fraction,统计0的比例,等。

    我们刚接到一个项目时,一开始并不是如何设计模型,而是去先跑一个现有的模型,看在项目需求在现有模型下面效果怎么样.当现有模型效果不错需要深入挖掘时,仅仅时跑现有模型是不够的,比如,如果你要在嵌入式里面去 ...

  5. react-redux的使用

    在react-redux 框架中,给我提供了两个常用的API来配合Redux框架的使用,其实在我们的实际项目开发中,我们完全可以不用react-redux框架,但是如果使用此框架,就如虎添翼了. 我们 ...

  6. 云笔记项目-Spring事务学习-传播NOT_SUPPORTED

    接下来测试事务传播属性设置为NOT_SUPPORTED Service层 Service层主要设置如下,其中还插入了REQUIRED作为比较. package Service; import java ...

  7. centos7 安装 transmission

    貌似官方文档 注意:是centos7才能用此方法 Step 1. First, you need to enable EPEL repository on your system. yum insta ...

  8. Linux nfs使用krb5的方式安全挂载

    配置安全的网络nfs文件共享服务 由于本人是使用的rhce模拟考试环境来做的本题目,所以文中说到的实验脚本和评分脚本,以及krb5.keytab文件只有我本套环境独有,如果自己做练习可以不去使用实验脚 ...

  9. Android判断一个点是否在矩形区域内

    个人遇到的问题判断按钮的点击事件还是滑动事件 private boolean button1Down = false; private boolean button2Down = false; pri ...

  10. 区间dp(入门题)

    区间dp:顾名思义就是在区间上进行动态规划,通过合并小区间求解一段区间上的最优解. 常见模板: for(int len=1;len<n;len++){//区间长度 for(int be=1;be ...