需要帮助使用 RVM 在 Ruby on Rails 上配置 Redis 支持的库

发布于 2024-11-08 07:02:21 字数 2415 浏览 0 评论 0原文

我遵循安装 resque 的配置指南。我遇到了(LoadError)。我正在使用 RVM 1.9.2-p180、rails 3.0.6 和 POW。这可能是我的加载路径完全错误的问题。所以这里有一些额外的信息:

 master ~/projects/chaggregator $ which rails
/Users/boris/.rvm/gems/ruby-1.9.2-p180/bin/rails
 master ~/projects/chaggregator $ which ruby
/Users/boris/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
 master ~/projects/chaggregator $ whereis ruby
/usr/bin/ruby
 master ~/projects/chaggregator $ whereis rails
/usr/bin/rails

config / resque.yml

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

初始化程序/ resque.rb:

rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'

resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env] 

终端:

~ $ cd projects/MyApp/
 master ~/projects/MyApp $ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb
/Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/resque-1.16.1/bin/resque-web:16:in `load': no such file to load -- rails_root/config/initializers/resque.rb (LoadError)
    from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/resque-1.16.1/bin/resque-web:16:in `block in <top (required)>'
    from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:54:in `call'
    from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:54: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服务器(当我点击localhost: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.

I'm following the configuration guidelines for installing resque. I'm met with a (LoadError). I'm using RVM 1.9.2-p180, rails 3.0.6, and POW. This is probably an issue with my load path being totally wrong. So here is some extra info:

 master ~/projects/chaggregator $ which rails
/Users/boris/.rvm/gems/ruby-1.9.2-p180/bin/rails
 master ~/projects/chaggregator $ which ruby
/Users/boris/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
 master ~/projects/chaggregator $ whereis ruby
/usr/bin/ruby
 master ~/projects/chaggregator $ whereis rails
/usr/bin/rails

config/resque.yml

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

initializers/resque.rb:

rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'

resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env] 

Terminal:

~ $ cd projects/MyApp/
 master ~/projects/MyApp $ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb
/Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/resque-1.16.1/bin/resque-web:16:in `load': no such file to load -- rails_root/config/initializers/resque.rb (LoadError)
    from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/resque-1.16.1/bin/resque-web:16:in `block in <top (required)>'
    from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:54:in `call'
    from /Users/boris/.rvm/gems/ruby-1.9.2-p180/gems/vegas-0.1.8/lib/vegas/runner.rb:54: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-server (I am connecting an extra client when I hit localhost: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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鱼忆七猫命九 2024-11-15 07:02:21

您不能在命令行中使用rails_root:

 master ~/projects/MyApp $ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb

尝试:

RAILS_ENV=production resque-web config/initializers/resque.rb

You can't use rails_root in the command line:

 master ~/projects/MyApp $ RAILS_ENV=production resque-web rails_root/config/initializers/resque.rb

try:

RAILS_ENV=production resque-web config/initializers/resque.rb
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文