redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
$ pip install redis
>>> import redis
>>> conn = redis.Redis()
>>> conn.keys('*')
Traceback (most recent call last):
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 484, in connect
sock = self._connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 541, in _connect
raise err
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/henry/.local/lib/python3.5/site-packages/redis/client.py", line 667, in execute_command
connection.send_command(*args)
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 585, in send_packed_command
self.connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 484, in connect
sock = self._connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 541, in _connect
raise err
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 529, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/henry/.local/lib/python3.5/site-packages/redis/client.py", line 1032, in keys
return self.execute_command('KEYS', pattern)
File "/home/henry/.local/lib/python3.5/site-packages/redis/client.py", line 673, in execute_command
connection.send_command(*args)
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 610, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 585, in send_packed_command
self.connect()
File "/home/henry/.local/lib/python3.5/site-packages/redis/connection.py", line 489, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
上面是错误代码,出现这样的错误,解决方案:
这个问题是因为没安装Redis服务器造成的。
要么是安装一个redis,或者是启动redis。
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.的更多相关文章
- redis.exceptions.ConnectionError: Error 10061 connecting to 127.0.0.1:6379. 由于目标计算机积极拒绝,无法连接
redis.exceptions.ConnectionError: Error 10061 connecting to 127.0.0.1:6379. 由于目标计算机积极拒绝,无法连接 是由于没有 ...
- [Redis-CentOS7]Redis打开远程连接(十) Could not connect to Redis at 127.0.0.1:6379: Connection refused
通过网络无法访问Redis redis-cli 172.16.1.111 Could not connect to Redis at 127.0.0.1:6379: Connection refuse ...
- Redis 服务端配置——Could not connect to Redis at 127.0.0.1:6379: Connection refused
[root@centoszang 桌面]# redis-cli Could : Connection refused Could : Connection refused not connected& ...
- Could not connect to Redis at xxx.xxx.xxx.xxx:6379: Connection refused
开发发来消息说测试环境的redis无法登录: # redis-cli -p 6379 -h xxx.xxx.xxx.xxx Could not connect to Redis at xxx.xxx. ...
- 在 Linux redis 验证交互连接过程中遇到 redis Could not connect to Redis at 127.0.0.1:6379: Connection refused 的解决方法
Could not connect to Redis at 127.0.0.1:6379: Connection refused 1.找到redis.conf 并修改 daemonize no 为 d ...
- redis Could not connect to Redis at 127.0.0.1:6379: Connection refused 问题解决
1.启动redis 客户端 redis-cli 报错 redis Could not connect to Redis at 127.0.0.1:6379: Connection refused 是因 ...
- Could not connect to Redis at 127.0.0.1:6379: Connection refused
启动redis: redis-server ../redis.conf redis启动成功后 执行命令行redis-cli报:Could not connect to Redis at 127.0. ...
- Redis配置主从时报错“Could not connect to Redis at 192.168.0.50:6379: Connection refused not connected>”
配置Redis主从时,修改完从节点配置文件,然后报错 [root@Rich七哥-0-50 redis]# /opt/redis/redis-cli -h 192.168.0.50 Could not ...
- Could not connect to Redis at 192.168.0.129:6379: Connection refused
在虚拟机上(CentOS 6.7)本机连接自己的redis [root@localhost bin]# ./redis-cli -h Could not connect to Redis at : C ...
随机推荐
- linux1
虚拟内存:内核通过磁盘上的存储空间来实现虚拟内存,这块区域称为交换空间.内核不断交换空间和实际的物理内存之间反复交换虚拟内存中的内容 linux运行中的程序叫做进程. 内核创建了第一个进程,叫做Ini ...
- list的基本操作实现
有关list的相关实现,主函数没有写很多,每个部分目前没发现有问题: #include <iostream> #include <stdio.h> using namespac ...
- vue中用ajax上传文件
直接上代码 <input class="file-btn" type="file" @change="uploadCompany($event) ...
- RoR - More Active Record
Active Record Scope: default_scope: 默认的检索方式 #Use unscoped to break out of the default class Hobby ...
- python实现ip地址查询经纬度定位
1.此api已经关闭 https://api.map.baidu.com/highacciploc/v1?qcip=220.181.38.113&ak=你申请的AK&extension ...
- python列表排重:列表排重并计算字符出现的次数
a=[,,,,,,,,,,,] dictc={} for i in range(len(a)): dictc[a[i]]=a.count(a[i]) for key in dictc: print k ...
- 22.C# 事件
1.事件的含义 事件和异常类似,它们都是由对象引发,我们可以提供代码处理它们.不同的是事件并没有使用try ..catch这样的代码来处理,而是要订阅事件,订阅的含义是提供一段事件处理代码,在事件发送 ...
- pytorch中tensorboardX的用法
在代码中改好存储Log的路径 命令行中输入 tensorboard --logdir /home/huihua/NewDisk1/PycharmProjects/pytorch-deeplab-xce ...
- if __name__ == '__main__' 这段代码怎么理解???
__name__是内置变量,可用于表示当前模块的名字,而“__main__”等于当前执行文件的名称. 两个名称搞不清没关系,往下看待会解释 对很多编程语言来说,程序都需要一个入口,例如C系列.Java ...
- matlab——之class类(详细总结)
https://blog.csdn.net/qinze5857/article/details/80545885 开篇:搜了一下网上介绍matlab的class类,信息不全,且总结不全面,于是单独he ...