You can configure a reader or slave database in Matomo by editing your config file in
config/config.ini.php and configuring the reader like this:
[database_reader] host = example.host username = example_user password = example_password dbname = example_db_name port = 3306
If configured, the following queries will be executed on the reader (slave) instead of the writer (master):
- archiving queries that hit a log table
- live queries that hit a log table
We recommend to only configure a reader if you can ensure there is a minimal replication lag / delay on the reader. Otherwise you might get corrupt/outdated data in the reports.
Please note that when you are configuring a reader and are using custom plugins that add new reports (that have a custom archiver), these plugins need to make sure to make use of the reader as otherwise queries will fail. All plugins from Matomo / InnoCraft are compatible. Most third party plugins are automatically compatible as well.