我已禁用 redis 监听端口 6379 并启用了 websocket。它在我的应用程序中运行得非常好,但是当我启动 resque-web 时,它一直在通过网络接口(interface)监听并失败并显示消息:
Can't connect to Redis! (redis://127.0.0.1:6379/0)
有人知道是否可以让 resque-web 使用套接字而不是网络?
提前致谢
最佳答案
我一直在阅读 resque-web 的代码,我意识到它会在内部加载您提供的任何路径作为命令的参数。所以我创建了一个简单的 ruby 脚本,它使用 redis gem 连接到 Redis,然后将这个实例分配给 Resque.redis:
刚刚创建了一个名为“resque-web-hack.rb”的文件:
require 'redis'
require 'resque'
$redis = Redis.new(:path => '/tmp/redis.sock')
Resque.redis = $redis
然后像这样使用它:
$ resque-web /path/to/my/file/resque-web-hack.rb
这只是一个 hack,但现在对我有用......
关于redis - 是否可以开始 resque-web 监听 redis 套接字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7010668/