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

Ste*_*ven 32 resque redis

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

$ QUEUE=mailer rake environment resque:work --trace
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

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

Tas*_*ass 54

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

ps aux | grep redis

你应该看到类似的东西:

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

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

nohup redis-server &

这将启动redis-server进程并将其从终端分离.否则我相信你需要在你希望redis-server运行的整个时间内打开终端.

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

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


Pra*_*oya 14

你安装了redis吗?

在Ubuntu上安装REDIS

参考:http://redis.io/download

  1. 下载,提取和编译Redis: -

    $ cd ~/Installations
    $ curl -O http://redis.googlecode.com/files/redis-2.2.1.tar.gz
    $ tar xzf redis-2.2.1.tar.gz
    $ cd redis-2.2.1
    $ sudo make
    
    Run Code Online (Sandbox Code Playgroud)
  2. 安装Tcl(工具命令语言)运行时

    $ sudo apt-get install tcl8.5
    
    Run Code Online (Sandbox Code Playgroud)
  3. 运行Redis服务器

    $ src/redis-server
    [31371] 24 Feb 10:14:03 # Warning: no config file specified, using the default config. In order to   specify a config file use 'redis-server /path/to/redis.conf'
    [31371] 24 Feb 10:14:03 * Server started, Redis version 2.2.1
    [31371] 24 Feb 10:14:03 # WARNING overcommit_memory is set to 0! Background save may  fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    [31371] 24 Feb 10:14:03 * The server is now ready to accept connections on port 6379
    
    Run Code Online (Sandbox Code Playgroud)


SSR*_*das 9

去做就对了:- sudo apt-get install redis-server