How to install Redis on Debian
Posted: Tue Dec 29, 2020 10:37 pm
Hi,
Short intro about Redis:
Redis, an acronym for Remote Dictionary Server, is a fast and open-source key-value data store that is stored in memory. The development of Redis began when its creator, Salvatore Sanfilippo, aimed to enhance the scalability of his Italian startup. Over time, Redis evolved into a versatile data store that is used as a database, cache, message broker, and queue.
With sub-millisecond response times, Redis can handle millions of requests per second, making it a valuable tool for real-time applications across industries such as gaming, advertising technology, financial services, healthcare, and the Internet of Things. Redis has become one of the most widely-used open-source engines and has been dubbed the "Most Loved" database by Stack Overflow for five consecutive years. Its lightning-fast performance makes Redis a popular choice for use in caching, session management, gaming leaderboards, real-time analytics, geospatial applications, ride-hailing services, chat/messaging platforms, media streaming, and pub/sub apps.
In the following steps, we will guide you through the installation process of Redis on a Debian server.
You must have shell access with sudo privileged account access to Debian 10 system. First of all, log in to your system and upgrade the current packages.
1st run:
2nd run
After installation, enable Redis service to start on system boot.
Now navigate to your /etc/redis/redis.conf file and add this 2 lines on the end of the file:
The above configuration tells Redis to remove any key using the LRU algorithm when the max memory of 256mb is reached. Save the configuration file and restart the Redis service:
Install Redis PHP Extension (This is an optional step. If you need to connect Redis from PHP application, You need to install Redis PHP extension on your Debian system. To install Redis PHP extension, simply type:)
The installer will automatically enable redis extension for all the pre installed PHP versions. If you installer new PHP version after this, you can use below command to enable redis module. For example to enable extension for PHP 7.4, type:
Now Connect to Redis Server
Use redis-cli tool to verify the connection between the Redis server
Few more examples of redis-cli command line tool:
This tutorial helps you with the installation of Redis server on Debian 10 system.
Short intro about Redis:
Redis, an acronym for Remote Dictionary Server, is a fast and open-source key-value data store that is stored in memory. The development of Redis began when its creator, Salvatore Sanfilippo, aimed to enhance the scalability of his Italian startup. Over time, Redis evolved into a versatile data store that is used as a database, cache, message broker, and queue.
With sub-millisecond response times, Redis can handle millions of requests per second, making it a valuable tool for real-time applications across industries such as gaming, advertising technology, financial services, healthcare, and the Internet of Things. Redis has become one of the most widely-used open-source engines and has been dubbed the "Most Loved" database by Stack Overflow for five consecutive years. Its lightning-fast performance makes Redis a popular choice for use in caching, session management, gaming leaderboards, real-time analytics, geospatial applications, ride-hailing services, chat/messaging platforms, media streaming, and pub/sub apps.
In the following steps, we will guide you through the installation process of Redis on a Debian server.
You must have shell access with sudo privileged account access to Debian 10 system. First of all, log in to your system and upgrade the current packages.
1st run:
Code: Select all
sudo apt update
Code: Select all
sudo apt upgrade
Code: Select all
sudo apt install redis-server
Code: Select all
sudo systemctl enable redis-server
Code: Select all
maxmemory 256mb
maxmemory-policy allkeys-lru
Code: Select all
sudo systemctl restart redis-server
Code: Select all
sudo apt install php-redis
Code: Select all
sudo phpenmod -v 7.4 -s ALL redis
Use redis-cli tool to verify the connection between the Redis server
Code: Select all
redis-cli
127.0.0.1:6379> ping
PONG
Code: Select all
$ redis-cli info
$ redis-cli info stats
$ redis-cli info server