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 ...
随机推荐
- loback.xml 在idea中代码自动完成
1.下载xsd文件 2.idea添加xsd文件 URI: http://ch.qos.logback/xml/ns/logback File: D:\env\plugins\logback\logba ...
- mongodb与sql语句对比
左边是mongodb查询语句,右边是sql语句.对照着用,挺方便. db.users.find() select * from users db.users.find({"age" ...
- chown virtualbox
virtualbox安装 root@cbill-VirtualBox:/# chown --help用法:chown [选项]... [所有者][:[组]] 文件... 或:chown [选项]... ...
- Java 容器使用中如何选择
Collection ├List │├LinkedList │├ArrayList │└Vector │└Stack ├Queue │├Deque │└LinkedList └Set ├Sort ...
- POJ-1308 Is It A Tree?(并查集判断是否是树)
http://poj.org/problem?id=1308 Description A tree is a well-known data structure that is either empt ...
- Ajax请求文件下载操作失败的原因和解决办法
使用Poi做excel表格导出功能,第一个想到的就是用Ajax来发送请求,但是Ajax和后台代码都执行了,就是无法下载文件. 前台代码 function exportExl(){ var form = ...
- DFS判断连通图
因为是连通图,所以从任意一点出发,一定可以通过一遍深度优先遍历就能走过所有的点和边,就可以利用这个性质来很容易的通过DFS判断图是否为连通图 下面是具体算法:
- h5-渐变的基本描述
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- h5-自定义视屏播放器
1.html代码 <h3 class="playerTitle">视屏播放器</h3> <div class="player"&g ...
- JAVA中常用的异常处理情况
1.java.lang.nullpointerexception程序遇上空指针 这个异常大家肯定都经常遇到,异常的解释是"程序遇上了空指针",简单地说就是调用了未经初始化的对象或者 ...