这个错发生在celery中用redis 作为backend 传输返回结果时发生的错误,以前也遇过这个错,但是没有放在心上,今天偶然发现所有节点都出现了该报错,并且影响了队列的正常消费,所以时候对这个错误一探究竟了。

先贴上原始报错代码:

 \"result\": {\"exc_type\": \"ResponseError\", \"exc_message\": \"Command # 1 (SETEX b'celery-task-meta-2ed2b92a-7901-4d5c-83e5-58128d9e2573' 3600 {\\\"task_id\\\": \\\"2ed2b92a-7901-4d5c-83e5-58128d9e2573\\\", \\\"traceback\\\": null, \\\"status\\\": \\\"SUCCESS\\\", \\\"children\\\": [], \\\"result\\\": false}) of pipeline caused error: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.\"}}) of pipeline caused error: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error."}}) of pipeline caused error: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

 

网上的基本解决方案都是:

将配置项stop-writes-on-bgsave-error 设置为no,可以在redis命令行里配置,也可以在redis.conf配置文件里改。

这么改一般是可以解决问题的。

但是网上很多教程基本上没有做过多的解释。

但是看到配置文件里的注释就很清晰了:

然而如果配置了redis服务器的监控和持久化,您可能希望禁用此功能,使Redis将继续工作,即使出现了磁盘故障、权限等问题。

结合报错信息与配置项的字面意思,也就是redis出现了错误,但是redis并没有配置持久化,所以就会导致错误信息没办法保存,所以直接报错了。

至于出现了什么样的错误,从报错中也是看不出来的,一般也是应用层问题。

以上,作为备忘,今后发现进一步celery 的错误 再补充