Back

How to Install Redis on Ubuntu 18.04


What is REDIS?

Developed in 2009, REmote Dictionary Server(REDIS) is an open source, NoSql key value database. You can say it’s a data structure server for developers to organize and use data efficiently and quickly. It is written in ANSI C.

It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.

Why use REDIS?

Redis is a popular choice for caching, session management, gaming, leaderboards, real-time analytics, geospatial, ride-hailing, chat/messaging, media streaming, and pub/sub apps.

Redis delivers sub-millisecond response times enabling millions of requests per second for real-time applications in Gaming, Ad-Tech, Financial Services, Healthcare, and IoT.

Step 1 – Prerequsities

Update the apt-get packages index files and also update existing packages to the newest versions by using the following commands:

sudo apt-get update
                    
sudo apt-get upgrade
                    

Step 2 - Installing Redis

Run below command from the terminal to install Redis on your machine:

sudo apt-get install redis-server
                    

Enable Redis to start on system boot. Also restart Redis service once.

sudo systemctl enable redis-server.service
                    

Step 3 – Configure Redis

Although you don’t need to configure to start redis. But if you want to change something according to your needs. You need to edit this file :

sudo vim /etc/redis/redis.conf
                    

You can increase max memory limit as per available on your server.

maxmemory 256mb
                    maxmemory-policy allkeys-lru
                    

Save the configuration file and restart the Redis service:

sudo systemctl restart redis-server.service
                    


Step 4 – Test Connection to Redis Server

Use redis-cli tool to verify the connection between the Redis server.

127.0.0.1:6379> ping
                    PONG
                    127.0.0.1:6379>
                    
Redis image

If you’re getting this error:

Could not connect to Redis at 127.0.0.1:6379: Connection refused
                    
Redis image

Then, Open a terminal and type this command:

redis-server
                    

If you liked this post, then share it with friends :-)

Thank you!

img

What is kubernetes and why is it used?

Kubernetes is a word that you hear more and more these days as Containerization becomes more popular...

Buffer overflow for kids

A buffer, in terms of a program in execution, can be thought of as a region of computer’s main memory that has certain boundaries in context...

Get in touch_

Or just write me a letter here_