Transfering control panel resources between hosts and partitions

Overview

The mf-transfer script automates the transfer of resources between servers and between partitions. It handles both copying the data and also updating the control panel resource to reflect the new location.

The command copies data from the source location to the destination location. If you are moving a resource from one partition to another on the same server, then the source and destination servers will be the same.

The command line script should be run as root from the destination server. Run mf-transfer to get up-to-date usage instructions.

A new high level comments on how it works:

  1. You will be prompted for your control panel username and password so the control panel items can be updated via the API.
  2. If the source server is remote, you will be prompted to add the destination root ssh public key to the appropriate non-privileged user’s authorized_keys file on the source machine (and it will be automatically removed when you are done).

Downtime

When moving resources between servers we can expect:

  1. Mailboxes: for approximately 15 - 30 seconds (the time it takes to update the control panel to reflect the new server), users will get an error if they are trying to download their email or access a mailbox.
  2. Databases: Usernames are switched to read-only just before the database is dumped and remain read-only until the database is imported. That may or may not cause visible errors depending on the application using the database is designed (Drupal and Wordpress seem to display ok but will throw errors for anyone who is logged in).
  3. Web sites: No downtime!! If someone is uploading a file during the transition, there is a small chance they will upload the file, the site will transition and the file won’t be there, but then the file will appear with the final sync.

Is everything really off?

After moving everything off of a server, here are a few SQL queries to run to determine that all records have been properly moved.

Replace “SERVER” with the server in question.

SELECT * FROM red_item WHERE item_status != 'deleted' AND item_host = 'SERVER.mayfirst.org';