redis数据库写入数据时提示redis.exceptions.ResponseError错误
今天运行Django项目在redis数据库写入数据时提示如下错误:
ERROR log 228 Internal Server Error: /image_code/cf9ccd75-d274-45c0-94a4-a83c8c189965/
Traceback (most recent call last):
File "/home/sky/.virtualenvs/dj_xm31/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/sky/.virtualenvs/dj_xm31/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/sky/.virtualenvs/dj_xm31/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/sky/code/djxm31/xm31/dj13/dj13/apps/verifications/views.py", line 14, in image_code
redis_conn.setex('img_{}'.format(img_id).encode('utf8'),300,text)
File "/home/sky/.virtualenvs/dj_xm31/lib/python3.6/site-packages/redis/client.py", line 1787, in setex
return self.execute_command('SETEX', name, time, value)
File "/home/sky/.virtualenvs/dj_xm31/lib/python3.6/site-packages/redis/client.py", line 878, in execute_command
return self.parse_response(conn, command_name, **options)
File "/home/sky/.virtualenvs/dj_xm31/lib/python3.6/site-packages/redis/client.py", line 892, in parse_response
response = connection.read_response()
File "/home/sky/.virtualenvs/dj_xm31/lib/python3.6/site-packages/redis/connection.py", line 752, in read_response
raise response
redis.exceptions.ResponseError: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
ERROR basehttp 154 "GET /image_code/cf9ccd75-d274-45c0-94a4-a83c8c189965/ HTTP/1.1" 500 89760

原因
强制关闭Redis快照导致不能持久化。
解决方案
将stop-writes-on-bgsave-error设置为no
(dj14) sky@py:~$ redis-cli
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379>
redis数据库写入数据时提示redis.exceptions.ResponseError错误的更多相关文章
- 读取redis中的数据时出现:MISCONF Redis is configured to save RDB snapshots
读取redis中的数据时出现:MISCONF Redis is configured to save RDB snapshots 以下为异常详细信息: Exception in thread &q ...
- 从redis数据库取数据存放到本地mysql数据库
redis数据库属于非关系型数据库,数据存放在内存堆栈中,效率比较高. 其存储数据是以json格式字符串存储字典的,而类似的关系型数据库无法实现这种数据的存储. 在爬取数据时,将数据暂存到redis中 ...
- redis存json数据时选择string还是hash
redis存json数据时选择string还是hash 我们在缓存json数据到redis时经常会面临是选择string类型还是选择hash类型去存储.接下来我从占用空间和IO两方面来分析这两种类型的 ...
- 深入理解 EF Core:EF Core 写入数据时发生了什么?
阅读本文大概需要 14 分钟. 原文:https://bit.ly/2C67m1C 作者:Jon P Smith 翻译:王亮 声明:我翻译技术文章不是逐句翻译的,而是根据我自己的理解来表述的.其中可能 ...
- mysql数据库delete数据时不支持表别名!!!
mysql数据库delete数据时不支持表别名!!! mysql delete时候 提示语法错误!如下sql: 去掉 表别名的时候: 正确的写法例如: DELETE FROM COMMENTS_REP ...
- python 使用xlsxwriter 写入数据时,当数据中链接的后面包含空格时(如:"http://*** "),导出问题打开报错
python 在使用 xlsxwriter组件写入数据时,当数据包含类似“http://*** /”数据时,导出的excel,打开时会提示如下错误: 没有查到相关的资料处理这个问题,可能原因为exce ...
- C#程序中从数据库取数据时需注意数据类型之间的对应,int16\int32\int64
private void btn2_Click(object sender, RoutedEventArgs e) { using (SqlConnection ...
- mysql数据库delete数据时不支持表别名
今天在帮同事查看一条删除的SQL语句执行出错的问题 SQL语句如下: 1 DELETE FROM LEAD_SYSTEM_MENU_ORG_REF as t WHERE t.resourceid='4 ...
- 转】mysql数据库delete数据时不支持表别名
原博文出自于: http://www.cnblogs.com/xdp-gacl/p/4012853.html 感谢! 今天在帮同事查看一条删除的SQL语句执行出错的问题 SQL语句如下: 1 DELE ...
随机推荐
- 启动运行python3时 UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 170: illegal multibyte sequence
重现 在cmd中输入Python,运行后,出现以下错误: Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64 ...
- 新iPhone的高售价下,苹果供应商们是该笑还是该哭?
自新 iPhone发布之日起,世界就从未停止讨论其售价,越来越多的人开始困惑:新 iPhone毫无创新亮点,有什么底气卖到12799RMB呢?整个地球都在期待苹果推出廉价版 iPhone,望眼欲穿地等 ...
- 滴滴与Uber都盯上拉美市场!一场惨烈竞争谁能胜出?
创业者最怕的是什么?或许并不是在创业初期的艰难历程.毕竟在初期虽然会遇到很多磨难和众多竞争对手,但只要敢打敢拼就有胜出的可能.创业者最怕的或许是成为所属行业独角兽后,要面对势均力敌对手的凶猛攻击!大家 ...
- GitHub上传家庭记账本
GitHub的使用参考之前的博客GitHub的初步了解和使用,并完成了相关的android个人家庭记账本的上传
- MySql 的操作指令(window)
1.登录: mysql -uroot -p 2.查看所有数据库: show databases 3.切换数据库 : use databasename(数据库名称) 4.查看数据库的所有表格 ...
- JavaWeb乱码问题及统一全站编码(通过Filter实现)
1. public class CharacterFilter implements Filter { private String characterEncoding = null; FilterC ...
- MySQL数据库索引常见问题
笔者看过很多数据库相关方面的面试题,但大多数答案都不太准确,因此决定在自己blog进行一个总结. Q1:数据库有哪些索引?优缺点是什么? 1.B树索引:大多数数据库采用的索引(innoDB采用的是b+ ...
- 统计web 访问日志的请求数据
tomcat日志格式 在配置文件 server.xml 中,具体参照官方文档 https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#A ...
- vue安装openlayers,jquery,bootstrap,阿里iconfont,
安装 安装openlayers安装指定包安装openlayersVUE中的地图import ol from "openlayers";import "openlayers ...
- 在项目中ES6语法转ES5语法 babel转码器
es6 babel 安装以及使用 1,安装好node(需要使用npm包管理工具) 2,在本地项目路径下npm init,格式化成功后会在项目下生成一个配置文件package.json 3,本地安装 ...