1

我开始一个工人:

rake environment resque:work RAILS_ENV=development VVERBOSE=1 QUEUE=* LOGFILE=/Users/matteo/workspace/APP/log/resque.log --trace

我得到输出:

** Invoke environment (first_time)
** Execute environment
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Execute resque:setup
** Execute resque:preload
** Invoke resque:setup 
** Execute resque:work

一个快速的 ps 告诉我该过程已启动并正在运行。

现在我没有运行 Redis 的实例。快速ps auxwwww | grep redis-server证实了这一点。

工人不应该失败吗?

我下载了 resque 代码并在 worker.rb 中的 resque 代码中放置了一个断点:

(rdb:1) eval redis
#<Redis::Namespace:0x007f868cb57880 @namespace=:resque, @redis=#<Redis client v2.2.2 connected to redis://127.0.0.1:6379/1 (Redis v0.07)>>

这怎么可能没有在那个端口上运行?谢谢你的帮助

4

2 回答 2

2

The answers is: "No, workers cannot run without a copy of Redis running".

The problem was caused by the fakeredis gem. Even though the gem was not included in the development environment the developer was requiring "redis/connction/memory" therefore using a fakeredis instance.

于 2012-09-27T22:07:44.157 回答
1

Resque 确实需要 redis 才能工作,虽然看起来您的队列已启动,但如果没有 redis,它将无法处理。

启动服务器后,您可以通过转到此 url 查看队列的状态...

http://localhost:3000/resque/overview

也就是说,如果您的 gemfile 中有以下内容

gem 'resque', :require => "resque/server"

或者,如果您没有该设置,请在控制台中运行此设置resque-web以获取可访问的管理界面localhost:3000/overview

If you don't get an error and can access that page without a redis error, redis must be running somewhere, perhaps as a service on bootup?

For basic redis/resque setup see here - http://railscasts.com/episodes/271-resque?view=asciicast

于 2012-09-27T21:07:39.133 回答