救援:连接被拒绝 - 无法连接到 localhost:6379 上的 Redis [英] Rescue : Connection refused - Unable to connect to Redis on localhost:6379

查看:68
本文介绍了救援:连接被拒绝 - 无法连接到 localhost:6379 上的 Redis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照说明安装 resque,但是现在当我尝试使用此命令生成一个 worker 时出现连接错误:

I have followed the instructions to install resque, but now when I try to spawn a worker with this command I get a connection error:

$ QUEUE=mailer rake environment resque:work --trace

这是我得到的错误:

连接被拒绝 - 无法连接到 localhost:6379 上的 Redis

Connection refused - Unable to connect to Redis on localhost:6379

推荐答案

您是否验证过 redis-server 正在运行?请不要让我剖析以下命令,但您可以在终端中输入:

Have you verified redis-server is running? Please don't ask me to dissect the following command, but in a terminal you can type:

ps 辅助 |grep redis

然后您应该会看到如下内容:

You should then see something like:

redis 13319 0.0 0.0 2884 1056 ?ss 10:54 0:00/usr/bin/redis-server/etc/redis/redis.conf

如果它没有运行,我建议发出以下命令:

If it's not running, I recommend issuing the following command:

nohup redis-server &

这将启动一个 redis-server 进程并将其与终端分离.否则,我认为您需要在希望 redis-server 运行的整个时间内保持该终端打开.

That will start a redis-server process and detach it from the terminal. Otherwise I believe you need to leave that terminal open the entire time you want redis-server to be running.

(一旦你启动它,验证进程是否正在运行总是一个好主意,所以再次使用第一个命令.)

(Always a good idea to verify the process is running once you fire it up, so use that first command once more.)

更新:我不确定这是否适用于所有版本,但在 Ubuntu 16.04 上的 Redis Server 3.0.6 上,您也可以发出 sudo service redis-server status.您会收到一些详细的输出,因此我不会全部发布,但对于我们中的某些人来说,这可能是另一种选择.

Update: I'm not sure if this works for all versions, but on Redis Server 3.0.6 on Ubuntu 16.04, you can issue sudo service redis-server status as well. You'll receive some verbose output, so I'll not post it all, but that may be another option for some of us.

这篇关于救援:连接被拒绝 - 无法连接到 localhost:6379 上的 Redis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆