Magento provides command line options to configure the Redis page and default caching. Although you can configure caching by editing the app/etc/env.php
file, using the command line is the recommended method, especially for initial configurations. The command line provides validation, ensuring the configuration is syntactically correct.
- Best Redis Client For Mac Os
- Redis Gui Client For Mac
- Mac Redis Client
- Redis Desktop Client For Mac
- Redis Client For Windows
You must install Redis before continuing.
Configure Redis default caching
Run the setup:config:set
command and specify parameters that specific to Redis default caching.
where
RethinkDB, Redis, and CouchDB are probably your best bets out of the 8 options considered. 'Easy install' is the primary reason people pick RethinkDB over the competition. This page is powered by a knowledgeable community that helps you make an informed decision. Redis Enterprise Software (RS) offers Redis Cluster. RS Cluster is just a set of Redis nodes (OS with Redis installed). It is composed of identical nodes that are deployed within a data center or stretched across local availability zones. Redis cluster is self-managed, so all you have to do is create a database with required options and it abstracts out the.
--cache-backend=redis
enables the Redis default caching. If this feature has already been enabled, omit this parameter.
Best Redis Client For Mac Os
--cache-backend-redis-=
is a list of key/value pairs that configure the default caching:
Command line parameter | Parameter | Meaning | Default value |
---|---|---|---|
cache-backend-redis-server | server | Fully qualified hostname, IP address, or an absolute path to a UNIX socket. The default value of 127.0.0.1 indicates Redis is installed on the Magento server. | 127.0.0.1 |
cache-backend-redis-port | port | Redis server listen port | 6379 |
cache-backend-redis-db | database | Required if you use Redis for both the default and full-page cache. You must specify the database number of one of the caches; the other cache uses 0 by default. Important: If you use Redis for more than one type of caching, the database numbers must be different. It is recommended that you assign the default caching database number to 0, the page caching database number to 1, and the session storage database number to 2. | 0 |
cache-backend-redis-password | password | Configuring a Redis password enables one of its built-in security features: the auth command, which requires clients to authenticate to access the database. The password is configured directly in Redis's configuration file, /etc/redis/redis.conf . |
Example command
The following example enables Redis default caching, sets the host to 127.0.0.1
and assigns the database number to 0. Redis uses default values for all other parameters.
Configure Redis page caching
To configure Redis page caching on Magento, run the setup:config:set
command with additional parameters.
where
--page-cache=redis
enables Redis page caching. If this feature has already been enabled, omit this parameter.
--page-cache-redis-=
is a list of parameter/value pairs that configure page caching:
Redis Gui Client For Mac
Command line parameter | Parameter | Meaning | Default value |
---|---|---|---|
page-cache-redis-server | server | Fully qualified hostname, IP address, or an absolute path to a UNIX socket. The default value of 127.0.0.1 indicates Redis is installed on the Magento server. | 127.0.0.1 |
page-cache-redis-port | port | Redis server listen port | 6379 |
page-cache-redis-db | database | Required if you use Redis for both the default and full page cache. You must specify the database number of one of the caches; the other cache uses 0 by default. Important: If you use Redis for more than one type of caching, the database numbers must be different. It is recommended that you assign the default caching database number to 0, the page caching database number to 1, and the session storage database number to 2. | 0 |
page-cache-redis-password | password | Configuring a Redis password enables one of its built-in security features: the auth command, which requires clients to authenticate to access the database. Configure the password within the Redis configuration file, /etc/redis/redis.conf. |
Example command
The following example enables Redis page caching, sets the host to 127.0.0.1
and assigns the database number to 1. All other parameters are set to the default value.
Results
As a result of the two example commands, Magento adds lines similar to the following to app/etc/env.php
:
Mac Redis Client
New Redis cache implementation
As of Magento 2.3.5, it is recommended to use the extended Redis cache implementation: MagentoFrameworkCacheBackendRedis
.
Redis preload feature
Since Magento stores a lot of configuration data in the Redis cache, we can preload data that is reused between pages.To find keys that need to be preloaded, you need to analyze data that is transferred from Redis to Magento. We suggest to preload data that is loaded on every page, common examples are SYSTEM_DEFAULT
, EAV_ENTITY_TYPES
, DB_IS_UP_TO_DATE
.Redis uses the pipeline
in order to composite load requests.Please note that keys should include the database prefix, e.g. if database prefix is 061_
, preload key will looks like 061_SYSTEM_DEFAULT
.
In case you are using the preload feature with the L2 cache, do not forget to add the ‘:hash' suffix to your keys, since L2 cache only transfers the hash of the data, not the data itself:
Parallel generation
Starting with the 2.4.0 release, we introduced the allow_parallel_generation
option for the users that want to eliminate waitings for locks.It is disabled by default, and we recommend keeping it disabled until you have excessive configurations and/or blocks.
To enable it, run:
Since it is a flag, you cannot disable it with a command. You will need to manually set the configuration value to false
:
Basic verification
To verify that Redis and Magento are working together, use the following commands:
Redis monitor command
In a command prompt on the server on which Redis is running, enter:
Refresh your storefront page and you'll see output similar to the following.
Redis Desktop Client For Mac
Session storage
If you use Redis for session storage, you'll see output similar to the following:
Page caching
If you use Redis for page caching, you'll see output similar to the following:
Redis ping command
Redis Client For Windows
Enter the following command:
PONG
should be the response.
If both commands succeeded, Redis is set up properly.