2011-05-20 44 views
7

我遵循配置指南安装resque。我遇到了(OpenURI :: HTTPError)。我正在使用RVM 1.9.2-p180,rails 3.0.6和POW.'resque-web'未能以500服务器错误启动。这里发生了什么?resque-web无法启动500服务器错误

要复制问题:RAILS_ENV=development resque-web config/initializers/resque.rb

配置/ resque.yml:

  1. 开始Redis的使用$零一二三五四零二三七八九零八四零五四九七三二一零
  2. 启动工作与$ VVERBOSE=1 QUEUE=file_serve rake environment resque:work
  3. 尝试启动Resque的Web

    development: localhost:6379 
    test: localhost:6379 
    staging: localhost:6379 
    fi: localhost:6379 
    

    初始化/ resque.rb:

    rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..' 
    rails_env = ENV['RAILS_ENV'] || 'development' 
    
    require 'resque' 
    # require 'yaml' 
    
    unless defined?($redis) 
        $redis = Redis.new($redis = Redis.new(:host => 'localhost', :port => 6379)) 
    end 
    
    Resque.redis = $redis 
    

    终端:

     master ~/projects/MyApp $ RAILS_ENV=development resque-web config/initializers/resque.rb 
    [2011-05-20 11:42:48 -0700] Starting 'resque-web'... 
    /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:346:in `open_http': 500 Internal Server Error (OpenURI::HTTPError) 
        from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:769:in `buffer_open' 
        from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:203:in `block in open_loop' 
        from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:201:in `catch' 
        from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:201:in `open_loop' 
        from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:146:in `open_uri' 
        from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:671:in `open' 
        from /Users/boris/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/open-uri.rb:33:in `open' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:142:in `port_open?' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:159:in `check_for_running' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:104:in `start' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:77:in `initialize' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/resque-1.16.1/bin/resque-web:13:in `new' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/resque-1.16.1/bin/resque-web:13:in `<top (required)>' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/bin/resque-web:19:in `load' 
        from /Users/boris/.rvm/gems/ruby-1.9.2-p180/bin/resque-web:19:in `<main>' 
    

    Redis的服务器(我连接一个额外的客户端时,我打本地主机:6379。

    [33324] 20 May 11:02:08 - 1 clients connected (0 slaves), 932400 bytes in use 
    [33324] 20 May 11:02:12 - Accepted 127.0.0.1:53028 
    [33324] 20 May 11:02:13 - DB 0: 7 keys (0 volatile) in 8 slots HT. 
    [33324] 20 May 11:02:13 - 2 clients connected (0 slaves), 942976 bytes in use 
    [33324] 20 May 11:02:18 - DB 0: 7 keys (0 volatile) in 8 slots HT. 
    

    初始化器/ redis.rb

    $redis = Redis.new(:host => 'localhost', :port => 6379) 
    

    终端:(为$证明的Redis)

    > $redis 
    #<Redis client v2.2.0 connected to redis://localhost:6379/0 (Redis v2.2.5)> 
    ruby-1.9.2-p180 :003 > $redis.set('pepper', 'bacon') #=> "OK" 
    ruby-1.9.2-p180 :004 > $redis.get('pepper') #=> "bacon" 
    
+0

有点相同的问题,你解决了吗? – Rubytastic 2012-06-04 14:10:01

+2

我有同样的错误信息(500内部服务器错误),但是由于不同的原因:已经有一个在其缺省端口5678上运行的'resque-web'实例。'resque-web -K'用来终止现有进程为我解决了这个错误信息。 – gempesaw 2015-12-16 15:14:00

回答

3

您有:

$redis = Redis.new($redis = Redis.new(:host => 'localhost', :port => 6379)) 

尝试只是在做:

$redis = Redis.new(:host => 'localhost', :port => 6379)