Some Drupal users may want to use Redis as a caching solution, but have no experience at all with setting it up.
Perhaps we can list the minimal steps required to get Redis up and running in popular environments, such as DDEV and a standard Debian Apache server?
Look at the documentation and feel overwhelmed.
List the basic steps to set up Redis in popular environments, such as DDEV and a standard Debian Apache server.
The text below is adapted from these articles:
Setting up Redis in DDEV
Install Redis → , as you would normally install a Drupal module → .
Install the Redis DDEV package and restart DDEV. A new service is created, and the settings files updated:
$ ddev get ddev/ddev-redis $ ddev restart
You should be good to go; Drupal will store its cache in the Redis database. Check by visiting a cached page, then open the Redis command line, type
KEYS *
, and press "Enter" (you should see many lines):user@my-os> ddev redis-cli redis:6379> KEYS * 1) "drupal.redis.10.0.9..1b1d36866cd3838283aff4aa23abebfdebf122e1b8ce37e991cfd42e9aee7e8a:default:twig:65674054c9edd_page-title.html.twig_C-aI28H1wCRg97iJeFau2jScU" [...]
Adapted from https://cyberschorsch.dev/drupal/elevating-drupals-capabilities-redis-ad....
Setting up Redis on Debian/Apache server
Install the Redis package (which creates a new service) and the PHP Redis extension on the server, and enable it:
$ sudo apt install redis-server php-redis $ sudo phpenmod redis
Check if it is running, and make it start at every boot:
$ sudo service redis status
Make it start automatically after every boot:
$ sudo systemctl enable redis-server
Now paste this into the
settings.php
files:$settings['container_yamls'][] = 'modules/contrib/redis/redis.services.yml'; $settings['redis.connection']['interface'] = 'PhpRedis'; $settings['redis.connection']['host'] = '127.0.0.1'; $settings['redis.connection']['port'] = 6379; $settings['cache']['default'] = 'cache.backend.redis'; $settings['cache']['bins']['render'] = 'cache.backend.redis'; $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.redis'; $settings['cache']['bins']['page'] = 'cache.backend.redis';
For details on installation and configuration, for example Redis performance tuning, see:
Decide if this can be added in a documentation page?
Active
2.0
Documentation
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.