Migrating a Centova Cast v3 installation to another server

Question:

How can I migrate my Centova Cast v3 installation to another server?

Answer:

Migrating a Centova Cast v3 installation is a very advanced procedure which should only be performed by qualified systems administrators. Be sure to backup your data carefully in advance.

Note that this article is for migrating full Centova Cast installations only, including the web interface. If you are migrating a control (slave) server which is controlled by a separate web interface server, refer to this article instead.

DO NOT decommission your old server, or update DNS to point to your new server, until you have successfully performed the migration and verified that the streams are working on the new server.

To migrate a Centova Cast installation from Server A to Server B:

  1. Update Srver A to the latest Centova Cast version.

    For example:

    /usr/local/centovacast/sbin/update
    
  2. Login to your client account at centova.com. Click Manage Product Licenses, then click on your Centova Cast license. Then, click the Re-issue license link. At this point, Server A will be left without a valid license, but will continue to work normally for several days.

  3. Install Centova Cast on Server B per the installation manual.

    Be sure to install it exactly as you did on Server A, including the same streaming server and autoDJ software and any configuration file modifications you may have made.
    Note: In the particular case of Liquidsoap, it may not be possible to upgrade to the latest version on older systems. In this case, you will want to hold off the installation of Liquidsoap (on server B), until after you have completed the migration.

  4. Stop Centova Cast on server A:

    /usr/local/centovacast/centovacast stop
    
  5. Stop Centova Cast on server B:

    /usr/local/centovacast/centovacast stop
    
  6. Backup your Centova Cast database on Server A. You can do this using the mysqldump command via SSH, or using a web-based tool such as phpMyAdmin.

    For example:

    mysqldump -uroot -p CAST_DB_NAME > cast_db_backup.sql
    
  7. Backup the /usr/local/centovacast/var/vhosts/ directory on Server A. By far the fastest and most efficient way to do this, is to use rsync to copy the entire directory and its contents directly to server B.

    For example:

    rsync -avze ssh /usr/local/centovacast/var/vhosts/ serverb.example.com:/usr/local/centovacast/var/vhosts
    

    Replace serverb.example.com with the hostname or IP address of server B.

    If rsync is not available for some reason, you can alternatively use FTP, NFS or any other method available that would allow you to copy the contents of /usr/local/centovacast/var/vhosts/ over to server B.

  8. On Server B, restore the database backup you made in step 2. You can do this using the mysql command via SSH, or using a web-based tool such as phpMyAdmin.

    For example:

    cat cast_db_backup.sql | mysql -uroot -p CAST_DB_NAME
    
  9. On server B, update your filesystem permissions and ownerships by running:

    /usr/local/centovacast/sbin/fixperms
    
  10. Start Centova Cast on server B:

    /etc/init.d/centovacast start
    
  11. If your IP address(es) on your new server are different from your old server's IP address(es), login to Centova Cast on server B and update each stream with the new IP address.

    Also make any IP address or hostname changes that may be necessary under Management->Hosts.

    Tip (advanced users only): IP address changes can be automated using shell scripting if desired. To change the IP addresses in the database, prior to step 8 (above) run:

    cat cast_db_backup.sql | sed 's/oldip/newip/g' > cast_db_backup.sql.new
    

    Then import cast_db_backup.sql.new into your new database on server B. You'll also need to change the IP addresses in all configuration files on disk. After step 7 (above), run:

    find /usr/local/centovacast/var/vhosts -name '*.conf' -o -name 'settings.liq' | xargs sed -i -e 's/oldip/newip/g'
    
  12. After restoring the database, and starting Centova Cast on server B, login to the web interface using the admin account, and restore the authentication key under Management > Hosts > Edit cluster server, to match the key in "/usr/local/centovacast/etc/rpcshadow" on server B.

    To see the contents of rpcshadow via SSH, run:

    cat /usr/local/centovacast/etc/rpcshadow
    

At this point, you should have a working Centova Cast installation on Server B. Login to Server B and test your streams to make sure that they are working.

NOTE: This article is for Centova Cast v3 only; an alternate version exists for Centova Cast v2.