Redis package is not included in the default CentOS repositories. It can be installed from the Remi repository. |
In order to install Redis, you need to have root permission.
STEP 1. Enabling the Remi repository
sudo yum install epel-release yum-utils sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm sudo yum-config-manager --enable remi |
STEP 2. Install the Redis package by typing:
sudo yum install redis |
STEP 3. Once the installation is completed, start the Redis service and enable it to start automatically on boot with:
sudo systemctl start redis sudo systemctl enable redis |
You can check the status of the service by:
sudo systemctl status redis |
If you face any technical issue in using redis from remote connection, you will need to run below:
sudo sed -i 's/bind 127.0.0.1/#bind 127.0.0.1/gi' /etc/redis.conf sudo sed -i 's/protected-mode yes/protected-mode no/gi' /etc/redis.conf sudo /usr/sbin/setsebool httpd_can_network_connect=1 |
Below shell script is useful, when you monitor Redis status on your CentOS terminal
#!/bin/bash
for i in {0..1024}
do
clear
redis-cli info clients
sleep 1
done |
Or you can check its status as:
redis-cli --stat |
If you want to check it on remote server
redis-cli -h 10.0.1.17 -p 6379 info memory |
To clear Redis, run:
redis-cli flushall |
To get memory specific stats, run:
redis-cli info memory |