How to secure redis server and use in sidekiq

Serhan Balcı
Jul 25, 2017 · 1 min read

First of all, open redis-server config file in ubuntu system.

/etc/redis/redis.conf

in configuration file find and replace this line and uncomment it.

# requirepass foobared

replace foobared string with proper password such as,

echo “my-strong-password” | sha256sum

its generated like that, f2e7b3585d12ae57a5d121dff6e521dd09adacf3b76153d41e141fabde9ca5b9

in /etc/redis/redis.conf file we will put this password like this,

requirepass f2e7b3585d12ae57a5d121dff6e521dd09adacf3b76153d41e141fabde9ca5b9

after that we restart redis server.

sudo service redis-server restart

after that we will re-write sidekiq.rb file like this,

config.redis = { 
:url => ‘redis://localhost:6379/sidekiq’,
:namespace => ‘sidekiq-server’,
:password => ‘f2e7b3585d12ae57a5d121dff6e521dd09adacf3b76153d41e141fabde9ca5b9’ }

then testing…

Serhan Balcı

Written by

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade