(Please note that the below mentioned steps and troubleshooting is not for Heroku. These are specifically for dedicated servers, VPS etc.)
Following are the steps to debug, troubleshoot and fix commonly faced Sidekiq and Redis related issues in RoR app.
1. Firstly, make sure Sidekiq URL is working.
In case if the app has restricted access to Sidekiq web url then we need to login as admin user to view sidekiq web administrator page.
2. If this url shows you "Internal Server Error" then make sure "redis" is working properly on server.
Check if its latest version of redis is present and that its supported properly by Sidekiq.
Commands as follows (path could be specific based on your server conf.)
Output of this command if redis is installed -->
Redis server v=2.8.5 sha=00000000:0 malloc=jemalloc-3.2.0 bits=64 build=5a96806625c34309
If redis is not installed then please install it using following commands
wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make
Start redis server using command
3. Make sure sidekiq is running and working properly.
ps -ef | grep sidekiq
28521 24322 3 08:21 pts/2 00:00:27 sidekiq 2.9.0 [0 of 25 busy]
4. If step-3 above shows that sidekiq is not running then use the following commands to run sidekiq. Make sure to run it from app\_path
nohup bundle exec sidekiq -e staging -C config/sidekiq.yml -P tmp/pids/sidekiq.pid >> log/sidekiq.log 2>&1 &
5. Now check sidekiq.log file for any errors.
Tail it using command
tail -500 log/sidekiq.log
6. If step 5 above i.e. log shows errors then try troubleshoot using following steps
Check redis.conf file (Path = /etc/redis/redis.conf) and ensure that everything is set for redis and sidekiq configuration to run smoothly.
This section in redis.conf file is important
For default save/load DB in/from the working directory. Note that you must specify a directory not a file name. dir /var/lib/redis
- If folder /var/lib/redis does not exists then create one using following commands
sudo su - mkdir /var/lib/redis
- Make sure that folder /var/lib/redis has proper read and write access for redis user
chown -R redis:redis /var/lib/redis
Kill any earlier running version of redis and restart redis to read configuration again.
Test sidekiq now by queuing some tasks to perform. (Email, Others etc.)
Check url http://staging.app.com/sidekiq and it should now show "Processed" section with counts.
Subscribe to Engineering At Kiprosh
Get the latest posts delivered right to your inbox