【问题标题】:Resque Not Selecting Correct Server From ConfigResque 未从配置中选择正确的服务器
【发布时间】:2012-09-05 22:37:38
【问题描述】:

我正在尝试将我的 Reddis 服务器移至外部设备。已按照 github 上的 Resque 自述文件进行操作。

在开发模式下,它可以正常加载配置并连接到 6379 上的 localhost:

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]

resque.yaml

 development: localhost:6379
 playground: redis1.play.xxx.com:6379
 production: redis1.pro.xxx.com:6379

但是,在游乐场/生产模式下,它会退回到开发服务器并且无法连接。我假设这是因为独角兽没有正确声明环境?

如果我在初始化程序中将“开发”替换为“游乐场”,它会起作用。

我开始独角兽:

 unicorn -c config/unicorn.rb -E playground -l 8000 -D

我怎样才能让它选择正确的conf??

【问题讨论】:

    标签: ruby-on-rails redis resque unicorn


    【解决方案1】:

    虽然我真的不明白为什么,但终于排序了……如果有人想插话,我会在几天内不接受我自己的答案。

    通过让上帝管理服务而不是手动启动/停止,它选择了正确的环境。

    现在我正在毫无问题地连接到远程 redis 服务。

    【讨论】:

      猜你喜欢
      • 2020-07-23
      • 1970-01-01
      • 1970-01-01
      • 2022-12-29
      • 2012-04-10
      • 2011-10-24
      • 1970-01-01
      • 1970-01-01
      • 2012-01-09
      相关资源
      最近更新 更多