Redis is a an Open Source advanced key-value cache and store .
Redis Defualt port number : 6379
Redis Source Package Version : Redis 3.0.2 Stable Version (Release Notes)
Redis Download URL : http://redis.io/download
What’s new in Redis 3.0 compared to Redis 2.8?
- Redis Cluster: a distributed implementation of a subset of Redis.
- New “embedded string” object encoding resulting in less cache misses. Big speed gain under certain work loads.
- AOF child -> parent final data transmission to minimize latency due to “last write” during AOF rewrites.
- Much improved LRU approximation algorithm for keys eviction.
- WAIT command to block waiting for a write to be transmitted to
the specified number of slaves. - MIGRATE connection caching. Much faster keys migraitons.
- MIGRATE new options COPY and REPLACE.
- CLIENT PAUSE command: stop processing client requests for a specified amount of time.
- BITCOUNT performance improvements.
- CONFIG SET accepts memory values in different units (for example you can use “CONFIG SET maxmemory 1gb”).
- Redis log format slightly changed reporting in each line the role of the instance (master/slave) or if it’s a saving child log.
- INCR performance improvements.
Follow the given below steps to install redis server on CentOS 7 and Red Hat Enterprise Linux 7.
Install wget utility
yum install wget |
Install EPEL repo
First we will install the EPEL repo. For more detail on EPEL repo, we suggest you to read our this post.
Because our system has x86_64 Operating System architecture, we will use only epel repo package for x86_64 . Search epel repo package as per your Operating System architecture(EPEL URL)
wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/e/ |
Install redis server
Now use yum command to install redis server
yum install redis |
Two important redis server configuration file’s path
- /etc/redis.conf
- /etc/redis-sentinel.conf
Now start the redis server after this.
systemctl start redis.service |
To test the installation of Redis, use below given command
redis-cli ping |
If the response output is PONG, it means installation is completed successfully.
[root@localhost ~]# redis-cli ping |
To enable redis server at system’s booting time.To disable redis server at system’s booting time.
systemctl enable redis.service |
Install Redis 3.0 On Ubuntu 14.04 / CentOS 7 / RHEL 7
Let’s quickly start the installation of Redis Server from source on Ubuntu/CentOS/Debian/RHEL .
You can follow the given below steps in Ubuntu/CentOS/RHEL as per defined commands.
Note: yum command is used in RHEL/CentOS and apt-get command used in Ubuntu/Debian .
Install prerequisite for Redis
Make and GCC packages are used for compiling the source package. Whereas, we are installing wget for downloading the redis source package.
In CentOS 7 / RHEL 7
yum install make gcc wget |
In Ubuntu
sudo apt-get update |
SPECIAL NOTE TO UBUNTU USER : Login as super user and follow the below given steps. To become superuser, use the below given command .
sudo su - |
Download Redis 3 stable Source package
Use wget command to download the stable release Redis 3.0.2 . We recommend you to always install stable release, which you can search in Redis Download URL
wget http://download.redis.io/releases/redis-3.0.2.tar.gz |
Untar downloaded Redis Tar ball
Use the tar command to extract out the Redis from the downloaded tarball file.
tar -xvzf redis-3.0.2.tar.gz |
Compiling of Redis from source
Once you extract the Redis Package from tarball, you will get the Redis directory.
In our case, we got directory with name called redis-3.0.2 .
Change to extracted out redis directory. Now you will do most of the command activity inside redis package directory ( i.e redis-3.0.2)
cd redis-3.0.2 |
Now compiling the dependencies of Redis , available inside extracted out redis directory.
cd deps |
Once the dependencies are compiled, now start compiling the redis. For this you have to change to one level back. Means go back to Redis installation directory.
cd .. |
The redis server is installed only with binaries in your system. In next section we will install init script.
Install init script
In this section we will install init script to manage the process of Redis.
You can use this method in CentOS 7/ RHEL 7 / Ubuntu 14.04 .
I hope you are still inside the Redis installation Directory. Inside the directory you will see utils directory . We have to change to utils directory and run the install_server.sh script.
cd utils |
Now you script will ask some question. When you hit only ENTER, the system will take default value or answer.
Given below is reference from our server.
[root@localhost redis-3.0.2]# cd utils/ |
Once the all above steps are done, we can start/stop/restart the Redis Server and also check its status.
In CentOS 7 / RHEL 7
To check status of Redis Server
systemctl stop redis_6379 |
To start Redis Server
systemctl start redis_6379 |
To stop Redis Server
systemctl stop redis_6379 |
To restart the Redis Server
systemctl restart redis_6379 |
In Ubuntu
To check the status Redis Server
service redis_6379 status |
To start Redis Server
service redis_6379 start |
To stop Redis Server
service redis_6379 stop |
To restart Redis Server
service redis_6379 restart |
Login into Redis Server
To login into redis server is quite easy. The command is applicable in CentOS 7/RHEL 7/ Ubuntu (as per this post, we only only selected these 3 Operating system)
Use below given command to login into redis server from localhost .
redis-cli |
See below given reference.
[root@localhost ~]# redis-cli |
To check help of redis-cli command.
redis-cli --help |
Check listening ports by redis
Use ss command to find the listening port.
ss -tanp|grep 6379
Given below is reference,
[root@localhost ~]# ss -tanp|grep 6379 |