Hot migration of Piwik from one server to another without data loss


(sutch) #1

The FAQ How can I move Piwik from one server to another, also migrating the data from one mysql server to another? is helpful, but ends with “Note that during the operation, visits will not be tracked”.

I’m considering moving Piwik to a new server without losing any visit data. Here is the process that I plan to use:

  1. Install Piwik on the new server.
  2. Export the MySQL database from the old server (users and permissions and site tables).
  3. Import the database records into the new server.
  4. Change the Piwik JavaScript on tracked websites.
  5. Export the MySQL database from the old server (statistics logger tables).
  6. Import the database records into the new server.
If the primary keys (piwik_log_visit.idvisit, piwik_log_action.idaction, piwik_log_link_visit_action.idlink_va) on the new server are set to begin at a value higher than the highest values of those keys on the old server, should this process be expected to work? Are there any other issues that should be of concern?

(Matthieu Aubry) #2

This would not work if the schema for logging tables changes during the update.


(sutch) #3

The schema should not change, since both servers will be using identical versions of Piwik.

Any idea if having a gap in idvisit values will affect Piwik’s results?