Upgrading Redis to 3.0.7 using Moonshine Redis Plugin

Objective

To learn how to upgrade redis from 2.8.9 to 3.0.7 using Moonshine Redis plugin

Steps

Step 1

Uninstall the redis 2.8.9 manually on the server. Ideally I wish the plugin took care of removing the old version. But it does not install the newer version if an older version is already installed on the server.

sudo service redis-server stop
sudo rm /usr/local/bin/redis-*
sudo rm -r /etc/redis/
sudo rm /var/log/redis_*
sudo rm -r /var/lib/redis/
sudo rm /etc/init.d/redis_*
sudo rm /var/run/redis_*

Step 2

The tcl package is a pre-requisite for redis installation. In application_manifest.rb, add:

package 'tcl8.5', :ensure => :installed

Step 3

Change redis version in moonshine.yml:

:redis:
  :version: 3.0.7

Step 4

Update the redis version in application_manifest.rb and make sure redis recipe is included:

configure(:redis => { :version => '3.0.7' }
recipe :redis

Step 5

Check in the changes to git. Deploy using Capistrano.

** [out :: rp] Notice: /Exec[shutdown redis]/returns: Could not connect to Redis at 127.0.0.1:6379: Connection refused
** [out :: rp] Error: /Exec[shutdown redis]: Failed to call refresh: redis-cli shutdown returned 1 instead of one of [0]
** [out :: rp] Error: /Exec[shutdown redis]: redis-cli shutdown returned 1 instead of one of [0]
** [out :: rp] Notice: /Service[redis-server]/ensure: ensure changed 'stopped' to 'running'

You may see some error messages. It's ok. Because it happens when you dick around the server like we did in step 1.

Step 6

SSH into the box and verify the new version of redis.

redis-cli
127.0.0.1:6379> INFO
# Server
redis_version:3.0.7

It will be better if the availability end point provides the version of redis in the JSON.

Summary

In this article, you learned how to automate upgrade of Redis as much as we can on Ubuntu using Moonshine Redis Plugin.

Reference

Moonshine Redis Plugin
How to uninstall redis server on Ubuntu


Related Articles