栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

处理python连接redis出现的问题

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

处理python连接redis出现的问题

一。刚开始连接redis

问题如下:redis.exceptions.ResponseError: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'ConFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use ConFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.

代码如下:

原因:redis运行在受保护模式,需要redis命令行下作设置:config set protected-mode no

解决办法:

需要在redis的客户端命令行下

redis-cli

受保护模式为no

config get protected-mode

config set protected-mode no

设置密码

config set requirepass 123456

二。 Error:Invalid input of type: 'dict'. Convert to a bytes, string, int or float first.

python的第三方包redis版本高了

pip install redis==2.10.6

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/423020.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号