Ruby / Resque / Redis: How to configure workers on different machines?

I was looking for resque for distributed background jobs. I managed to get everything to work on the same machine through a demo application. But I do not know how to configure everything so that the workers work on different machines. I read that it is simply necessary that workers have a connection with the redis server. But I still don’t know where to start. Is there a step-by-step instruction somewhere? I did not find documentation about this.

Or can someone explain this to me?

I do not use btw rails, I use Sinatra.

thanks

+4
source share
2 answers

Yes you are right. If your worker can access redis, you can connect them for distribution on another machine.

To do this, the employee must be connected to redis (I assume that it is available to all workers)

Now in Resque to connect to this remote redis all he needs to do is like

Resque.redis = "redis://[your host]:[your port]"

you can also see the same as the mention here

Perhaps define it in your config/application.rb

Hope for this help

+3
source

The Redis Security Guide assumes that it is not safe to put a Redis server on the public Internet. Thus, your safest bet is probably designed to create an SSH tunnel from each working computer to the Redis server. Instructions can be found here:

https://briandamaged.org/blog/?p=1675

Once you have secured your Redis server and created the SSH tunnel, your workers can connect to the server by accessing the port on localhost. For instance:

 # Port 2000 is a tunnel to the Redis server Resque.redis = "redis://localhost:2000" 
0
source

All Articles