Before a Database upgrade on a high traffic Piwik server, it is highly recommended to:
Disable Piwik Tracking
In the config/config.ini.php, add the following
[Tracker] record_statistics = 0
This will cause all Piwik Tracking requests to return quickly the 1*1 gif beacon, without connecting to the Database or doing any processing.
Disable the Piwik User Interface and APIs
To disable the User Interface and the APIs, but still track all of your data correctly, you can enable maintenance mode.
When maintenance_mode is on, a maintenance message instead of the standard Piwik reporting interface. Your data is still tracked as expected, but the UI and the Reporting APIs are disabled.
If you run the Piwik Database Upgrade script using the shell/console command, we highly recommend to turn Piwik off while the upgrade is in process. Disabling the Piwik User Interface will prevent other users from accessing Piwik while the Database upgrade is in process.
To do so, add the following in the config file:
[General] maintenance_mode = 1
The following XML messages will be returned by the API:
<result><error message="Piwik is in scheduled maintenance. Please come back later. "/></result>
When the Piwik update is finished, do not forget to re-enable Visit Tracking and/or the User Interface.
And if you need to recover any missing data that wasn’t tracked during the maintenance window, learn more in about replay the traffic to Piwik and ingest logs of piwik.php requests