Few days back we have installed Redis in Amazon cloud server and integrating it with Magento. So I thought of sharing the process if it could help anyone.

Before we move on installation we need to understand what is Redis.

What is Redis ?

Redis in-memory data structure store, used as a database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.

Reference : https://redis.io/

Steps to setup of Redis

To install Redis we need follow below steps:

sudo yum -y update
sudo yum -y install gcc make /*Required packages for compilation from source*/

Download the latest version of Redis from the website https://redis.io/

cd /usr/local/src
sudo mkdir redis_install
sudo wget http://download.redis.io/releases/redis-3.6.tar.gz
sudo tar xzf redis-3.6.tar.gz
cd redis-3.6
sudo make distclean && sudo make

Create Directories to copy the redis configuration file .

sudo mkdir /etc/redis
sudo mkdir /var/lib/redis
sudo mkdir /var/redis/
sudo cp src/redis-server src/redis-cli /usr/local/bin
sudo cp redis.conf /etc/redis/redis.conf

Now its time to edit the redis configuration file
sudo vi /etc/redis/redis.conf

You can edit the below settings
#Your redis server will only listen to connections made to the address specified in via the bind option
#By default Redis does not run as a daemon. Use 'yes' if you need it.
daemonize yes
# All the log related to Redis will be logged here
logfile "/var/log/redis.log"
dir /var/redis/

Download and install the init script

sudo wget https://raw.githubusercontent.com/saxenap/install-redis-amazon-linux-centos/master/redis-server

sudo mv redis-server /etc/init.d

sudo chmod 755 /etc/init.d/redis-server

sudo vi /etc/init.d/redis-server

In the configuration file you set the path of the redis configuration file.

sudo chkconfig --add redis-server
sudo chkconfig --level 345 redis-server on
sudo service redis-server start

Auto-enable and start the Redis server

Below command will create the new file if it does not exist.

sudo vi /etc/systctl.conf

Add the below code this file

vm.overcommit_memory = 1
systctl vm.overcommit_memory=1

Now you can test if the redis server is running or not .

redis-cli ping

If you received “PONG” response it means you are done ..

To configure Magento with Redis please follow the next blog “Configure Magento with Redis“.

Happy integration 🙂