What is Redis?
Redis is an open source repository, used to store data structures in memory. Besides, Redis can also be used as a database, cache or massage broker. Currently, Redis supports many different data structures such as String, Hash, List, Set... In addition, this repository also provides very high availability via Redis Sentinel, including monitoring, switch notifications automatic backup. Redis also allows automatic partitioning across multiple Redis nodes with Redis Cluster.
Conditions for installing Redis on CentOS 7
Before starting the steps in the guide below, make sure you are logged in as root.
Install Redis on CentOS 7
The Radis package is not included with the default CentOS repositories. Therefore, we will install Redis 5.0.2 from the Remi repository.
The installation process is relatively simple, follow these steps:
1. Start by enabling Remi repository. Run the following command in the SSH terminal:
yum-config-manager --enable remi
2. Install the Redis package:
After the installation is complete, check again with the following command.
./php-extension.sh status redis
Configure Redis on Website
After installing Redis on DirectAdmin, please configure Redis on the website to work. Each source code will have a different configuration. In this article, I only guide you to configure WordPress using the following 2 popular Plugins.
1. Configuring Redis with Redis Object Cache
Before installing you open the file wp-config.php
and add the following code to validate the key.
define( 'WP_CACHE', true );
define('WP_CACHE_KEY_SALT', 'nhap-vao-domain-cua-ban');
After installing the plugin you need to activate it. Navigate to Settings => Redis and click on “Enable Object Cache” and make sure the status shows “Connected”. If not, make sure you have added the configuration to the wp-config.php file as above.
2. Configure Redis with LiteSpeed Cache
If your website is using LiteSpeed cache, you can enable Redis directly on LiteSpeed Cache which supports connection environment.
You navigate to LiteSpeed Cache => Cache => Object and enable the configurations as attached image below then Save changes. If it is in the line Check the connection “Passed”, then you have successfully configured it.
summary
Through the tutorial on installing Redis on DirectAdmin to speed up the website, we hope to help you better understand Redis and how to connect to the Website. That will help your website have better speed and reduce the load on system resources.
Wish you can do it successfully.
Minh BKNS
Post a Comment
Post a Comment