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.
To use Redis as a cache follow these steps:
- Make sure you are using at least Matomo (Piwik) 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.
[Cache] backend = chained [ChainedCache] backends = array backends = redis [RedisCache] host = "127.0.0.1" 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