Contents:
Redis is an in-memory data structure store, used as a database server, cache, and message broker. Redis is written in C programming language. It also provides PHP module for communication between PHP script with the Redis server.
This tutorial will help you with the installation of the Redis server on a Debian 9 Stretch Linux system. The PHP application also required Redis PHP extensions to work.
First of all, Log in to your system with sudo privilege account using shell access, to which you need to install Redis.
ssh root@debian9
Update the apt-get packages index files and also update existing packages to the newest versions. Run the following commands from terminal:
sudo apt-get update sudo apt-get upgrade
The Redis packages are available under the default apt repository. For the installation of Redis on an Ubuntu VPS. Run below command from the terminal to install Redis on your machine:
sudo apt-get install redis-server
Next is to enable Redis to start on system boot. Also restart Redis service once.
sudo systemctl enable redis-server.service
Redis can be started without a configuration file using a built-in default configuration. But to make any extra parameter changes you can use its configuration file that is: /etc/redis/redis.conf. Edit the Redis configuration file in a text editor to make changes
sudo vim /etc/redis/redis.conf
Update the following values in Redis configuration file according to your requirement. You can increase max memory limit as per available on your server.
/etc/redis/redis.conf maxmemory 256mb maxmemory-policy allkeys-lru
Use the above configuration with 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:
sudo systemctl restart redis-server.service
To access the Redis server from a PHP application required php-redis extension. You also need to install this extension on your application server. So that your PHP application can communicate with the Redis server. Install this extension by running the following command:
sudo apt-get install php-redis
Use redis-cli tool to verify the connection between the Redis server and redis-cli. Access redis-cli terminal and type “ping”, You will get “PONG” in response with the successful connection.
redis-cli 127.0.0.1:6379> ping PONG 127.0.0.1:6379>
An alternative for the nmcli is the nmtui, short for Network Manager Text User Interface,…
MariaDB is an enhanced, drop-in replacement for MySQL. MariaDB can be a better choice for…
MariaDB is an enhanced, drop-in replacement for MySQL. MariaDB can be a better choice for…
Rclone is a command line program written in Go language, used to sync files and…
By default, authentication is disabled in MongoDB, but this is not so critical as, out…
What is Pip? pip is a tool for installing and managing Python packages. With pip…
Leave a Comment