今天运行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错误的更多相关文章

  1. 读取redis中的数据时出现:MISCONF Redis is configured to save RDB snapshots

    读取redis中的数据时出现:MISCONF Redis is configured to save RDB snapshots   以下为异常详细信息: Exception in thread &q ...

  2. 从redis数据库取数据存放到本地mysql数据库

    redis数据库属于非关系型数据库,数据存放在内存堆栈中,效率比较高. 其存储数据是以json格式字符串存储字典的,而类似的关系型数据库无法实现这种数据的存储. 在爬取数据时,将数据暂存到redis中 ...

  3. redis存json数据时选择string还是hash

    redis存json数据时选择string还是hash 我们在缓存json数据到redis时经常会面临是选择string类型还是选择hash类型去存储.接下来我从占用空间和IO两方面来分析这两种类型的 ...

  4. 深入理解 EF Core:EF Core 写入数据时发生了什么?

    阅读本文大概需要 14 分钟. 原文:https://bit.ly/2C67m1C 作者:Jon P Smith 翻译:王亮 声明:我翻译技术文章不是逐句翻译的,而是根据我自己的理解来表述的.其中可能 ...

  5. mysql数据库delete数据时不支持表别名!!!

    mysql数据库delete数据时不支持表别名!!! mysql delete时候 提示语法错误!如下sql: 去掉 表别名的时候: 正确的写法例如: DELETE FROM COMMENTS_REP ...

  6. python 使用xlsxwriter 写入数据时,当数据中链接的后面包含空格时(如:"http://*** "),导出问题打开报错

    python 在使用 xlsxwriter组件写入数据时,当数据包含类似“http://*** /”数据时,导出的excel,打开时会提示如下错误: 没有查到相关的资料处理这个问题,可能原因为exce ...

  7. C#程序中从数据库取数据时需注意数据类型之间的对应,int16\int32\int64

    private void btn2_Click(object sender, RoutedEventArgs e)         {             using (SqlConnection ...

  8. mysql数据库delete数据时不支持表别名

    今天在帮同事查看一条删除的SQL语句执行出错的问题 SQL语句如下: 1 DELETE FROM LEAD_SYSTEM_MENU_ORG_REF as t WHERE t.resourceid='4 ...

  9. 转】mysql数据库delete数据时不支持表别名

    原博文出自于: http://www.cnblogs.com/xdp-gacl/p/4012853.html 感谢! 今天在帮同事查看一条删除的SQL语句执行出错的问题 SQL语句如下: 1 DELE ...

随机推荐

  1. spring boot redis 缓存(cache)集成

    Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 sp ...

  2. jquery散记

    感觉jquery的用法都要忘没了,简单捡一下 1.window.onload与$(document).ready的区别 ()编写个数 window.onload = function(){} //不能 ...

  3. 生成私钥、公钥,配置到Git上

    ssh-keygen -t rsa -C "1032671220@qq.com" 输入完毕指令,输入密码.然后会在 /z/.ssh/文件夹下生成一个私钥rsa_id.公钥rsa_p ...

  4. springboot-war

    预览 1.pom.xml 与springboot-jar-web的区别是: 将 <packaging>jar</packaging> 替换成: <packaging> ...

  5. vSphere Replication5.5安装

    vSphere Replication5.5概述 VMware vSphere Replication简称VR是 VMwarevCenter Server 的扩展,提供基于管理程序的虚拟机复制和恢复功 ...

  6. POJ 1325 && 1274:Machine Schedule 匈牙利算法模板题

    Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12976   Accepted: 5529 ...

  7. POJ 3083:Children of the Candy Corn

    Children of the Candy Corn Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11015   Acce ...

  8. 18 12 24 html 表单学习

    html表单 表单用于搜集不同类型的用户输入,表单由不同类型的标签组成,相关标签及属性用法如下: 1.<form>标签 定义整体的表单区域 action属性 定义表单数据提交地址 meth ...

  9. linux中nc命令

    语法 nc [-hlnruz][-g<网关...>][-G<指向器数目>][-i<延迟秒数>][-o<输出文件>][-p<通信端口>][-s ...

  10. 翻译——3_Gaussian Process Regression

    使用不同的机器学习方法进行预测 续上篇2_Linear Regression and Support Vector Regression 高斯过程回归 %matplotlib inline impor ...