Create Redis instance for WordPress


Here's a step-by-step copy-paste tutorial:

# Create a new Redis instance for benchmark.test named "wp-test" listening on /tmp/redis.sock
cpcmd -d benchmark.test redis:create wp-test '[unixsocket:/tmp/redis.sock]'
# Switch to benchmark.test account to configure plugin
su benchmark.test
cd /var/www/html
# Install Redis object cache plugin
wp-cli plugin install --activate redis-cache
# Define Redis path
wp-cli config set WP_REDIS_PATH /tmp/redis.sock
# Enable Redis plugin
wp-cli redis enable
# Verify it is running
wp-cli redis status

Should you need to delete an existing Redis instance, you can go with:

cpcmd -d benchmark.test redis:delete wp-test

Optionally have some fun:

# Define key for site
wp-cli config set WP_CACHE_KEY_SALT benchmarktest
# Enable igbinary serializer
wp-cli config set WP_REDIS_IGBINARY true --raw
# Disable plugin banners
wp-cli config set WP_REDIS_DISABLE_BANNERS true --raw

Looking for installing igbinary PECL module? Learn how here ↗

Notes and cheats for a better ApisCP administration experience.