简体   繁体   English

Sidekiq无法连接到rails中的redis

[英]Sidekiq can't connect to redis in rails

I have my redis server installed and running, but when I connect sidekiq using bundle exec sidekiq it throws an error message 我安装并运行了我的redis服务器,但是当我使用bundle exec sidekiq连接sidekiq时会抛出一条错误消息

Timed out connecting to Redis on localhost:6379 在localhost:6379上连接到Redis超时

Redis Server is running on port: 6379. Redis Server正在端口上运行:6379。

Why are you using bundle exec sidekiq? 你为什么使用bundle exec sidekiq?

Try connecting with "redis-cli -h localhost" 尝试连接“redis-cli -h localhost”

I think it means you're redis server isn't running. 我认为这意味着你的redis服务器没有运行。 Try running sudo /etc/init.d/redis-server start on your terminal, also make sure redis has permission to write to /var/log/redis.log or it won't start. 尝试在终端上运行sudo /etc/init.d/redis-server start ,同时确保redis有权写入/var/log/redis.log,否则无法启动。

For the issue was my redis production url wasn't correct. 对于这个问题,我的redis生产网址不正确。

My fix was: 我的修复是:

  1. open $ sudo nano gitlab/htdocs/config/resque.yml 打开$ sudo nano gitlab/htdocs/config/resque.yml
  2. change production: redis://some-wrong-url:6379 to production: redis://localhost:6379 改变production: redis://some-wrong-url:6379 to production: redis://localhost:6379
  3. restarted my Bitnami stack $ sudo /opt/bitnami/ctlscript.sh restart 重新启动我的Bitnami堆栈$ sudo /opt/bitnami/ctlscript.sh restart

I first verified my redis url from the answer @henley left. 我首先从@henley左边的答案中验证了我的redis网址。

*Note I'm using a Bitnami stack *注意我正在使用Bitnami堆栈

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM