Pantheon has supported Redis for ages, and we host several sites on the platform. You can create the Redis binding from the Pantheon dashboard and enable it on a site in minutes. When you are done, the logged-in experience feels 15% faster and logged-in users, such as content editors, feel 15% happier.
Lando is Morpht’s preferred local dev environment, so in the course of doing some work on the site, I enabled Redis on the hosting site and configured Lando for local development. All worked fine, with the status page showing, “Connected, using the PhpRedis client.” Nice.
I was curious and wanted to see more. I started in Drupal with /admin/reports/redis to get more information about what Redis has been up to. I noticed that Lando was showing Redis version 5.x. I would have expected version 6 or 7.
I went to look at what the Pantheon hosted copy reports at /admin/reports/redis. I was really surprised to see “Version 2.8.23,” which is… old. I opened a ticket and was told this was the default Redis version being deployed.
After pinging our Pantheon colleagues, we found they have an early access program for Redis 6. We signed up and awaited a faster, better Redis. We soon heard back that we are good to go. Sweet!
Configuration was as simple as adding “object_cache: version: 6.2” to the pantheon.yml file, and after a deployment, the Pantheon site was reporting “Version 6.2.7.”
Much better 🙂
The matching change for .lando.yml was “cache: type: redis:6”
and then the site reported a version also starting with 6.
Done. I connected via the command line, saw objects being stored, and could track calls to redis on dev, test, and live on New Relic.
Two weeks passed without any problems. One day, out of the blue, running drush cr on local, a fellow developer got this error:
In RedisCacheTagsChecksum.php line 85:
NOAUTH Authentication required.
I could not replicate the error and even ended up running Xdebug on settings in settings.php 🙂
I’m sure you guessed by now - it was the configuration issue between Pantheon and Lando, similarly described here.
Now here is the fun part - being a DevOps-savvy engineer, I configured Redis using lando.yml, defining environment variables - CACHE_HOST, CACHE_PORT, and CACHE_PASSWORD, matching Pantheon’s Redis configuration, so the code snippet can work with lando in the same way it works when it runs in Pantheon.
This best practice of using the environmental variable burnt me this time - the Pantheon plugin, when using the pantheon lando recipe, defines these variables itself. Because I re-defined them, it caused a mismatch between what the Redis plugin expected. Once I removed my definition from the lando.yml and the problem went away. Nice 🙂
Once again, Redis is happily making the website faster and the customer happy.🙂