python - 启动 rq-worker 时如何修复 'Error 111 connecting to localhost:6379. Connection refused'?

标签 python linux flask redis worker

我在托管在 debian 9 机器上的 Web 应用程序中使用 flask、redis 和 rq-worker。当我启动 rq-worker 时,我收到此错误:“错误 111 连接到本地主机:6379。连接被拒绝”。

我已经检查过 Redis 是否已安装并正在运行,我尝试了这些命令:

/opt/apps/mywebapp/flask$ ps aux | grep redis
sib       4987  0.0  0.0  12784   976 pts/2    S+   09:37   0:00 grep redis
redis     6574  0.1  0.0  40860  3512 ?        Ssl  may28   3:38 /usr/bin/redis-server 127.0.0.1:6379
/opt/apps/mywebapp/flask$ redis-cli ping
PONG

我已阅读其他帖子,这是 Redis 正在运行并正在运行的证据。

我还检查了文件 redis.conf 并设置了这个变量:

bind 127.0.0.1

我又试了一次。

/opt/apps/mywebapp/flask$ rq worker

但我一直收到错误。

Error 111 connecting to localhost:6379. Connection refused.

最佳答案

不好意思,是redis的配置绑定(bind)属性,我设置的是127.0.0.1::00,但是正确的配置是127.0.0.1::01。

关于python - 启动 rq-worker 时如何修复 'Error 111 connecting to localhost:6379. Connection refused'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56381238/

相关文章:

c - 如何使 ncurses 在 C 中正确显示 UTF-8 字符?

python - 值错误: The following arguments have not been supplied: email

python - 从 Python 中的 unicode 字符串替换非 ascii 字符

python - 使用pyes进行 Elasticsearch

python - 为什么在Windows上datetime不能转换为<86400的时间戳?

python - url 中没有端口的 Flask 请求

python - Flask 未获取复选框值

python - 我们如何在 Python 中获取可选的类属性?

linux - 这个 bash 命令(find + xarg + grep)有什么问题?

linux - sed - 从字符串中提取特定字符