Install and Config Redis Server on CentOS Linux

Install and Config Redis Server Intro:

In this tutorial, we will look into the Installation and configuration of Redis NoSQL Server ( Install and Config Redis Server ). We will also discuss running Redis on External interfaces and Connect external Applications to Redis server and Whitelist the External IP addresses using IP Tables.

Install-config-redis-server-linux

Lets start with the installation of Redis server, Then we will go through the config process of Redis.

REDIS Installation:

Redis Server is available under EPEL repositories, So, first of all, add the EPEL repository to CentOS.

Now update the yum cache  and install the REDIS Server using the following yum command.

Redis Configuration File is located at /etc/redis.conf

Starting and Stopping  the REDIS server :

Starting :

Stopping:

Restarting :

Test the Installation:

Let’s check if the Redis server is up and running using following ps command.

Output :

We can also test the Redis server connection using   redis-cli  ( Redis Command line interface client )

The following command will send the ping  message to REDIS server. If the server responds with PONG ., Then your installation is successful.

Running Redis on External IP Address or on All Interfaces :

Change the bind IP Address to whatever IP you want or Simply specify 0.0.0.0  to listen on all interfaces.

Connect to Remote Redis on IP Address :

Redis Allow remote connections from SINGLE IP ADDRESS :

Following commands will add one IPTables rule to whitelist the Specified IP Address.

Before doing this, We need to make sure Redis is running on External IP address. So make the following changes in /etc/redis.conf 

Now whitelist the external IP address using the following command.

Testing Redis Server connection from Remote client :

To connect to the remote Redis Server we need to install the Redis-CLI. Redis-CLI is available under the redis-tools package. So go ahead and install the redis-tools package using the following command.

Ubuntu and Debian users :

Now Connect to the Remote Redis using the following command.

Example Connection :

Conclusion:

We have disussed about the install and config of Redis server and how to configure and run Redis Server on external interface and We also looked at how to connect to Redis NoSQL server from the Remote host.

Related Articles:

Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply