Lets you copy a Matomo Measurable (Website, Mobile App, ...) including all tracked raw data and generated reports from one Matomo instance to another Matomo instance.
Before executing the migration command we always recommend to make a backup of the target database and ideally also test
it first with the
dry-run flag (dry-run is faster but can take a long time as well and will give you an idea of how long migration
To start a migration execute the
migration:measurable command, example:
./console migration:measurable --source-idsite=1 --target-db-host=192.168.1.1 --target-db-username=root --target-db-password=secure --target-db-name=piwik2
Optional parameters are:
--target-db-prefix=piwik_ --target-db-port=3306 --skip-logs --skip-archives --dry-run --disable-db-transactions
Both Matomo instances may be on different servers with proper firewall rules that restrict database access on target instance.
In such case, the easiest way for source server to access target database is to create a ssh tunnel on new port (e.g. 3307) in another terminal.
Then, execute to the above command with
--target-db-port=3307 instead to access port 3306 on target host. Example:
ssh -NL 3307:localhost:3306 targetuser@targethost
Matomo instance and files in folders may be owned by a special user (e.g.
www-data) with restricted ssh access.
The abovementioned may be run either under root (e.g.
sudo ...), or the special user (
sudo -u www-data ...).
Please note that the migration can take a while depending on the amount of data that needs to be copied.
The migration tool will create a new website in the target Matomo and copy all the data from the source website to this newly created target website.
No data from the original Matomo instance will be deleted, only new data will be added to the new Matomo instance.
No premium feature data is currently being migrated.
View and download this plugin for a specific Matomo version: