Installing Redis on CentOS 7

In cases your application might use Redis as in memory Database to perform it’s own functionalities, then you must have in installed on the server at the time of running it, so let’s install it in a few steps on Cent OS.

Step 1

Run the below command to update yum repositories

Step 2

Add the EPEL repository, and update YUM to confirm your change

Step 3

Install Redis

Step 4

Start Redis server

Step 5

Make it run on system boot

Done.

Now we want to verify our installation. we are going to use  redis-cli ping  command and if it’s running fine we will get  PONG as response.

Now Redis is up and running, generally you can access it by redis-cli or conneting to it over port 6379.
Redis has many configuration for Persistence and Distributed deployment, you can apply your  preferred configuration in Redis config file under the /etc/redis.conf.

so let’s configure some basic persistence option of Redis.

Redis provides two options for disk persistence:

  • Point-in-time snapshots of the dataset, made at specified intervals (RDB).
  • Append-only logs of all the write operations performed by the server (AOF).

Each option has its own pros and cons which are detailed in the Redis documentation. For the greatest level of data safety, consider running both persistence methods.

Because the Point-in-time snapshot persistence is enabled by default, you only need to set up AOF persistence:
Todo this, set below values in redis.conf file.

then restart Redis  systemctl restart redis
Also to improve Redis performance, set the Linux kernel overcommit memory setting to 1.

But this will goes off if we reboot the system, to make it permanent add  vm.overcommit_memory = 1  to  /etc/sysctl.conf file and restart Redis service, then we are done.

Leave A Comment?