I want to export site data from one Matomo instance into another existing Matomo instance with the https://plugins.matomo.org/Migration plugin, exporting from one servers database into another servers database.
I got the command ready, but it times out and says it can’t connect. So I think I need to use SSH tunneling, but am not sure how to use the example. Specifically the command at the end:
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
Where should it be run? On my machine or Source server or Target server?
Maybe I could export the source code base AND database, import them on the target server temporarily, as a separate Matomo instance, and do the import operation directly on the target server?
It looked good, so I removed --dry-run and did the import. I did a test run with a single record first, so I knew it was going to end with a horrible error message, even after completing successfully:
Processed ArchiveMigration at 2022-11-12 18:10:27
ERROR [2022-11-12 18:10:27] 19920 Uncaught exception: /var/www/html/website/public_html/tempmatomo/matomo/libs/Zend/Db/Adapter/Pdo/Abstract.php(314): There is no active transaction [Query: , CLI mode: 1]
There is no active transaction
I wasn’t sure about importing a site with siteid 1, since it already existed. But the Migration plugin intelligently gave it a new siteid 5, the next available site ID.