问题描述
当我在生产中启动我的应用程序以在推出到服务器之前对其进行测试时,我注意到由 Resque.enqueue(worker) 调用的数据库操作之一是在错误的数据库上执行的!development.sqlite3 而不是 production.sqlite3.我正在使用零配置文件运行服务器和 resque.一定有办法在正确的环境下运行redis或resque.
默认值:&defaults主机:本地主机端口:6379发展:<<: *默认值测试:<<: *默认值分期:<<: *默认值生产:<<: *默认值
我找到的这个redis配置文件可能有key,但是redis不喜欢,说
*** 致命配置文件错误 ***读取配置文件,在第 1 行>>>'默认值:&默认值'错误的指令或错误的参数数量
您是否在生产环境中启动 resque worker?你可以这样做,
$ RAILS_ENV=生产队列=* rake resque:workWhen I launch my app in production to test it before rolling out to the server, I noticed that one of my database operations which is called by Resque.enqueue(worker) is performed on the WRONG database! development.sqlite3 instead of production.sqlite3. I'm running both the server and resque with zero configuration files. There must be some way to run redis or resque in the correct environment.
defaults: &defaults
host: localhost
port: 6379
development:
<<: *defaults
test:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults
This redis config file I found may hold the key, but redis doesn't like it, saying
*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 1
>>> 'defaults: &defaults'
Bad directive or wrong number of arguments
Did you start resque worker in the production environment ? You can do it like this,
$ RAILS_ENV=production QUEUE=* rake resque:work
这篇关于即使在生产模式下从服务器运行,Resque 也会写入开发数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!