Migrating Matomo from CentOS 7 to AlmaLinux 9 – Best Practices?

Hi everyone,

We are currently running our Matomo server on an aging CentOS 7 system. It only handles Apache/PHP, while MariaDB is on a dedicated server.

I am now planning to migrate the installation to a new AlmaLinux 9 server and wanted to ask if there are any tips or potential pitfalls I should be aware of during the migration.

My plan is:

  1. Copy the document root (Matomo installation) to the new server
  2. Set up the necessary cron jobs for Matomo
  3. Assign the old server’s IP to the new one

Would this approach work smoothly, or am I overlooking something important?
Any insights or experiences would be greatly appreciated!

Thanks & best regards from Austria,
Andreas

As a next step, I also plan to migrate our MariaDB server (currently also on CentOS 7) to a new AlmaLinux 9 server.

With around 200GB of data, the database is quite large, so I expect the migration to take some time. Do you have any tips & best practices on how to perform the migration with minimal downtime and no data loss?

I’d really appreciate any advice on:

  • The best way to transfer the data (e.g., mysqldump, rsync with innodb_flush_logs, or Percona XtraBackup)
  • How to minimize downtime during the switch
  • Any potential pitfalls you can think of

Thanks in advance for your insights!

Best regards,
Andreas

really noone any ideas / experiences with this? :disappointed_relieved:

Since it seems there aren’t many experiences regarding such migrations, I’ll outline my approach here, hoping it might assist others facing similar challenges in the future.

HTTP Server:
As expected, this was quite straightforward. Set up your new server, ensuring all necessary PHP modules (such as maxminddb) are installed. Transfer existing SSL certificates from the old server and configure the cron jobs—but activate these only once the new server is live. Copy the existing document root to the new server, and you can already start testing. If everything runs smoothly, simply switch the IP from the old server to the new one, and you’re done.

Database:
Due to the database size exceeding 200GB, I set up a Primary/Secondary replication cluster, resulting in minimal downtime of about 1-2 seconds during migration.
Details on replication can be found here: MariaDB Standard Replication.

The steps involved were:

  • Keep the old database server as primary.
  • Set up and configure the new MariaDB instance.
  • Restore the backup using mariabackup, configure as secondary, and ensure synchronization.
  • Break replication and promote the secondary to primary/standalone.
  • Update Matomo configuration to point to the new database IP, and you’re finished.

This ensured a fast, smooth migration with practically no downtime. :slight_smile:

I hope this information proves helpful to someone facing similar challenges in the future.

Best regards from Tirol,
Andreas