redis sentinel with ruby (on rails)

In the last article I introduced how to install and use redis sentinel. As I’m using ruby, I need to use this new redis configuration with ruby (on rails).

For ruby on rails use redis-sentinel gem.

Then your redis initializer will look like

You can use your redis then as usual.

When using sidekiq, configuration is pretty simple too

You can test your configuration. Run rails console and test with

if you see “127.0.0.1:6379”, something is probably wrong. Then try to set/get some key and check Redis.current once again.

Leave a Reply

Your email address will not be published. Required fields are marked *

8 × 1 =