博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
django 配置redis 部署到服务器 Connection not ready Connection has data
阅读量:2058 次
发布时间:2019-04-29

本文共 2243 字,大约阅读时间需要 7 分钟。

dTraceback (most recent call last):File "/home/env/lib/python3.7/site-packages/redis/connection.py", line 1199, in get_connection raise ConnectionError('Connection has data') redis.exceptions.ConnectionError: Connection has data During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/env/lib/python3.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/home/env/lib/python3.7/site-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "./web/views/account.py", line 50, in send_sms if form.is_valid(): File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 183, in is_valid return self.is_bound and not self.errors File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 175, in errors self.full_clean() File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 384, in full_clean self._clean_fields() File "/home/env/lib/python3.7/site-packages/django/forms/forms.py", line 405, in _clean_fields value = getattr(self, 'clean_%s' % name)() File "./web/forms/account.py", line 148, in clean_mobile_phone conn.set(mobile_phone,code,ex=60000) File "/home/env/lib/python3.7/site-packages/redis/client.py", line 1801, in set return self.execute_command('SET', *pieces) File "/home/env/lib/python3.7/site-packages/redis/client.py", line 898, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/home/env/lib/python3.7/site-packages/redis/connection.py", line 1204, in get_connection raise ConnectionError('Connection not ready')

经排查错误,由于我的redis配置(我的在/etc/redis.conf)

发现并未设置 bind 0.0.0.0
如果绑定到0.0.0.0那么所有机器上的地址都可以访问服务
还有daemonize yes

  • daemonize:yes:redis采用的是单进程多线程的模式。当redis.conf中选项daemonize设置成yes时,代表开启守护进程模式。在该模式下,redis会在后台运行,并将进程pid号写入至redis.conf选项pidfile设置的文件中,此时redis将一直运行,除非手动kill该进程。
  • daemonize:no: 当daemonize选项设置成no时,当前界面将进入redis的命令行界面,exit强制退出或者关闭连接工具(putty,xshell等)都会导致redis进程退出。

转载地址:http://mwxlf.baihongyu.com/

你可能感兴趣的文章
Go语言学习Part2:流程控制语句:for、if、else、switch 和 defer
查看>>
Go语言学习Part3:struct、slice和映射
查看>>
Go语言学习Part4-1:方法和接口
查看>>
Leetcode Go 《精选TOP面试题》20200628 69.x的平方根
查看>>
Leetcode C++ 剑指 Offer 09. 用两个栈实现队列
查看>>
Leetcode C++《每日一题》20200707 112. 路径总和
查看>>
云原生 第十一章 应用健康
查看>>
Leetcode C++ 《第202场周赛》
查看>>
云原生 第十二章 可观测性:监控与日志
查看>>
Leetcode C++ 《第203场周赛》
查看>>
云原生 第十三章 Kubernetes网络概念及策略控制
查看>>
《redis设计与实现》 第一部分:数据结构与对象 || 读书笔记
查看>>
《redis设计与实现》 第二部分(第9-11章):单机数据库的实现
查看>>
算法工程师 面经2019年5月
查看>>
搜索架构师 一面面经2019年6月
查看>>
稻草人手记
查看>>
第一次kaggle比赛 回顾篇
查看>>
leetcode 50. Pow(x, n)
查看>>
leetcode 130. Surrounded Regions
查看>>
【托业】【全真题库】TEST2-语法题
查看>>