By default Matomo (Piwik) caches data in the local filesystem of each server. If your Matomo environment consists of multiple servers a common problem is that caches are only invalidated on one server instead of all servers. To workaround this we recommend to use a shared cache for all of your servers. You can do this by installing and configuring Redis.

Known issues:

  • The Redis cache can be only used if all servers have the same path to the Matomo directory
  • There may be temporary issues while deploying a new Matomo version if not all servers are updated at the same time.

To use Redis as a cache follow these steps:

  • Make sure you are using at least Matomo 2.10 (latest Matomo version recommended)
  • Install Redis see Redis Quickstart
  • Install the PHP extension phpredis
  • Don’t forget to restart your webserver
  • Once successfully setup, enable it in the config file config/config.ini.php. Make sure to adjust the section [RedisCache] to your needs. You have to make this change on each of your server.

changes to config/config.ini.php:

backend = chained

backends[] = array
backends[] = redis

host = "" 
port = 6379
timeout = 0.0
password = ""
database = 14
; In case you are using queued tracking: Make sure to configure a different database! Otherwise queued requests will be flushed

Are you also using Redis for Queued Tracking? In that case we recommend running completely different Redis instances for each use case to avoid possible problems.

Previous FAQ: How do I configure Matomo to use Redis for better Tracking API scalability?