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. H5-处理支付-前端部分

    调用后台支付接口,得到返回数据 1.如果是支付宝,需要后台配置支付成功的回调页面路径,还要在页面创建一个标签装表单内容,此处是id为box的div标签 <div id="box&quo ...

  2. Mysql的隔离级别

    一.首先什么是事务? 事务是应用程序中一系列严密的操作,所有操作必须成功完成,否则在每个操作中所作的所有更改都会被撤消.也就是事务具有原子性,一个事务中的一系列的操作要么全部成功,要么一个都不做. 事 ...

  3. 第二次oo博客作业--多线程电梯

    这次的系列作业是写一个电梯调度,主要目的是让我们熟悉多线程. 第一次作业是一个傻瓜电梯的调度问题,要求也很简单,即每次接一个人就行了.我只用了两个线程,一个是输入线程,一个是电梯线程,输入线程负责从标 ...

  4. SpringCloud-day08-Hystrix断路器

    8.Hystrix断路器 8.1.Hystrix简介 在分布式环境中,许多服务依赖项中的一些必然会失败.Hystrix是一个库,通过添加延迟容忍和容错逻辑,帮助你控制这些分布式服务之间的交互. Hys ...

  5. Game Engine Architecture 1

    [Game Engine Architecture 1] 1.This book is really just the beginning of a fascinating and potential ...

  6. java 下载网络文件

    1.FileUtils.copyURLToFile实现: import java.io.File; import java.net.URL; import org.apache.commons.io. ...

  7. 聚宽获取财务数据+DataFrame写入txt

    from jqdata import jy from jqdata import * #获取股票列表,这里是板块内股票 pool=get_industry_stocks(',date='2016-09 ...

  8. CentOS 7 安装phpredis和redis(接上一篇centos7安装lnmp)

    一.安装扩展phpredis 1.PHP7 安装redis 扩展phpredis cd /root/software wget https://github.com/edtechd/phpredis/ ...

  9. django xadmin查找当前用户所在组

    self.request.user:获取当前登录用户用户名 qs = Group.objects.get(user=self.request.user)获取当前登录用户所在组qs.name 获取当前登 ...

  10. 内置函数-map

    ret = map(abs,[-1,1,2,3]) print(ret) for i in ret: print(i) l = [1,-2,3,6,8,-7] l.sort(key=abs) prin ...