Redis (Remote DIctionary Server) is open-source key value data structure store written in C and is used as a database, and cache. Debian is one the leading Linux-based distributions. The data manipulation and storage fall in the basic category of programmer’s task and Debian 11 provides support of several DBMS (DataBase Management System) to perform operations on data. In this article, we are going to demonstrate the installation guide of Redis on Debian 11; with this useful post, you will be able to install the Redis as well as learn its distinctive features and importance.
Features of Redis
There are always several reasons to use any software or service; one of them is the features offered by specific tools. Redis contains following notable features that must be considered before using it:
- Performance: Databases do require a storage medium to store the data: Most of the databases store data on hard disks or external drives; whereas the Redis keeps data on the server that ensures the quick data manipulation to enhance the performance.
- Data structures support: As Redis belongs to NoSQL databases category, that support data structures as well. Redis has extensive support of data structure as compared to its competitors. Moreover, it support following types: strings, lists, sets, hashes, bitmaps, streams, geospatial.
- Ease of Use: Unlike other databases that follow long lengthy queries to store and retrieve data; Redis can be used to perform operations of data by command supported data structures.
- Scalability: Redis provides a scaling option to adjust the cluster size; one can perform this action by scaling up, scaling in, or scaling out in Redis.
How to install Redis on Debian 11
It is good practice to update the packages repository by issuing the below-mentioned command:
Once the update is carried out successfully, you are ready to install Redis on Debian 11. It is observed that Redis package is available on the official repository of Debian 11; so, you can use the command mentioned below to get Redis support using apt package manager on your system:
To check Redis service is installed successfully on your Debian 11; use the command mentioned below to check the status of Redis server:
As it is shown in the output that service is running that guarantees the successful installation of Redis service on your Debian 11 system.
You can manage the status of the server using command line support of Debian 11, for instance, you can use the following command to stop the running Redis service:
In case the Redis service is stopped on your Debian 11, you can use the command mentioned below to start he service:
How to connect to Redis on Debian 11
Once the Redis is installed and the service is running; you can write the following command in terminal to connect your Debian 11 to Redis server:
Upon successful execution of above-mentioned command, it is noticed that Redis shell will be activated with a localhost IP address (127.0.0.1:6379):
You can write “ping” and hit enter after this IP address: you will get “PONG” in the output:
How to configure Redis on Debian 11
You can configure the Redis service on Debian 11 by accessing the “.conf” file that resides in “/etc/redis/redis.conf”. For instance, in our case we have used nano editor to access the “.conf” file; execute the following command to edit the file using nano editor:
Set the memory size : If you want to allocate the memory size of your own choice to Redis server; you have to write the memory size at the end of configuration file and save the file by using “Ctrl+S” and press “Ctrl+X” to get out of nano editor:
maxmemory-policy allkeys-lru
Set Authentication Password for Redis Shell: You can set password authentication for anyone who want to run command on your Redis shell; you can do so by following way:
Note: By default, Redis shell allows everyone to execute commands on its shell.
Locate the following line in “SECURITY” section of “.config” file:
You have to uncomment the line and write your password; write the following line and it will set password “linuxhint” for Redis Shell:
Once the changes are made successfully; you must restart the Redis service by issuing the command mentioned below:
After restarting Redis, start the Redis shell by using the command mentioned below and write ping here; you will notice the authentication alert:
For Authentication you have to write the following line before executing the command in Redis shell:
In our case, password is “linuxhint”, so we provided the password by following the above command and after successful authentication it will show “OK” on the shell and after that you can execute the commands:
Conclusion
Redis is a well-known NoSQL database to perform several operations on data and the notable features of Redis make it a good choice among its competitors. Moreover, this service can be installed on several operating systems too: In this post we have provided a detailed guide to install Redis on Debian 11. Alongside its installation, this post provides the configuration of Redis server as well its connection on Debian 11. The configuration file of Redis can be accessed to perform changes as the changes may vary from novice users to advanced users.