How to Upgrade Redis from 2.8.19 to 3.0.1: A Step-by-Step Compilation Guide for Developers


3 views

When moving from Redis 2.8.19 to 3.0.1, it's crucial to note that this is a major version upgrade that introduces several new features including Redis Cluster support. The compilation process remains similar but requires careful handling of the existing installation.

Before proceeding with the upgrade:

  • Back up your current Redis database using SAVE or BGSAVE
  • Document your current configuration parameters
  • Check for any deprecated features your application might be using
  • Schedule downtime for the migration

First, download and prepare the new version:

wget http://download.redis.io/releases/redis-3.0.1.tar.gz
tar xzf redis-3.0.1.tar.gz
cd redis-3.0.1

Compile the new version without interfering with your current installation:

make
make test
sudo make install PREFIX=/opt/redis-3.0.1

There are two recommended approaches:

1. Parallel Installation

# Stop old Redis
sudo service redis-server stop

# Start new Redis with custom port
/opt/redis-3.0.1/bin/redis-server --port 6380 --daemonize yes

# Migrate data
/opt/redis-3.0.1/bin/redis-cli --rdb dump.rdb
/opt/redis-3.0.1/bin/redis-cli -p 6380 --pipe < dump.rdb

2. In-place Replacement

# Stop old Redis
sudo service redis-server stop

# Replace binaries
sudo cp /opt/redis-3.0.1/bin/* /usr/local/bin/

# Start new Redis
sudo service redis-server start

Verify the upgrade was successful:

redis-cli --version
redis-cli INFO | grep redis_version

Check for any compatibility issues with your application and monitor performance metrics. The 3.0.1 version introduces improved memory management and persistence options worth exploring.

In case of issues, here's how to revert:

# Stop new Redis
sudo service redis-server stop

# Restore old binaries from backup
sudo cp /path/to/redis-2.8.19-backup/bin/* /usr/local/bin/

# Start old Redis
sudo service redis-server start

When upgrading Redis from version 2.8.19 to 3.0.1, there are several critical considerations. The process differs significantly from a simple package manager update since you're dealing with a compiled installation. The 2.8.x to 3.0.x transition introduced several architectural improvements including Redis Cluster support and enhanced persistence.

Before beginning the upgrade:

# Check current Redis version
redis-server --version

# Create backup of your data
redis-cli SAVE
cp /var/lib/redis/dump.rdb /backup/redis-dump-$(date +%Y%m%d).rdb

The recommended approach is to:

# Download and extract new version
wget http://download.redis.io/releases/redis-3.0.1.tar.gz
tar xzf redis-3.0.1.tar.gz
cd redis-3.0.1

# Compile with proper flags
make distclean
make
make test

If you encounter compilation errors, ensure you have required dependencies:

sudo apt-get install build-essential tcl

For minimal downtime, consider these approaches:

  1. Install 3.0.1 alongside your existing installation
  2. Test the new version with a replica configuration first
  3. Use Redis replication to sync data before switching

Version 3.0.1 introduces new configuration parameters. Compare your existing redis.conf with the new template:

diff /etc/redis/redis.conf redis-3.0.1/redis.conf

Pay special attention to these new directives:

cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000

After installation:

# Verify new version
redis-server -v

# Test basic functionality
redis-cli PING

If issues arise, you can revert by:

sudo service redis-server stop
sudo cp /backup/redis-dump-$(date +%Y%m%d).rdb /var/lib/redis/dump.rdb
sudo service redis-server start