Migrating a Centova Cast v3 slave (control server) installation to another server
Question:
How can I migrate my Centova Cast v3 slave (control server) to another server?
Answer:
Migrating a Centova Cast v3 installation is a very advanced procedure which should only be performed by qualified systems administrators. Familiarity with common Linux shell commands and basic use of SQL queries is required. Be sure to backup your data carefully in advance.
Note that this article is for migrating slave (control server) Centova Cast installations only, wherein the web interface is NOT installed on the server you want to migrate. If you are migrating a full Centova Cast installation (including a web interface) 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 slave (control server) installation from Server A to Server B:
Update server A to the latest Centova Cast version.
For example:
/usr/local/centovacast/sbin/update
Login to your client account at centova.com. Click
Manage Product Licenses
, then click on your Centova Cast license. Then, click theRe-issue license
link.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.
Stop all streams on server A. Make sure you do this now; if you do not, the states of each account (online/offline, etc.) will be out-of-sync with reality after the migration is complete.
Stop Centova Cast on server A:
/etc/init.d/centovacast stop
Stop Centova Cast on server B:
/etc/init.d/centovacast stop
Backup the
/usr/local/centovacast/var/vhosts/
directory on Server A. By far the fastest and most efficient way to do this is to usersync
to send it 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 alternately create a tarball of the
vhosts/
directory on server A, manually copy it to server B, and extract it on server B.For example, on server A:
cd /usr/local/centovacast/var/vhosts tar czvf /cast_backup.tar.gz *
Then copy the tarball to server B, and run:
cd /usr/local/centovacast/var/vhosts tar xzvf /cast_backup.tar.gz
On server B, update the stream configuration files to reflect server B's IP address by running:
find /usr/local/centovacast/var/vhosts -name '*.conf' -o -name 'settings.liq' | xargs sed -i -e 's/oldip/newip/g'
Replace
oldip
with the IP address for server A, andnewip
with the IP address for server B.On server B, update your filesystem permissions and ownerships by running:
/usr/local/centovacast/sbin/fixperms
A simple database change is required to complete the migration. You may perform these queries from the MySQL console (eg: running
mysql
at a shell prompt), via a web-based tool such as phpMyAdmin, or via Centova Cast's built-in database management tool (clickSystem->Utilities
in the web interface, then clickManage database
).a. First, we need to obtain Centova Cast's internal ID numbers for Server A and Server B. Run the following SQL query to list the hosting servers Centova Cast is configured to use:
SELECT id,title,ipaddress FROM rpchosts;
This should yield a list similar to the following:
+----+-------------------+--------------+ | id | title | ipaddress | +----+-------------------+--------------+ | 1 | Local server | 127.0.0.1 | | 2 | Server A | 10.0.0.50 | | 3 | Server B | 10.0.0.51 | +----+-------------------+--------------+
Here we can see that the ID number for server A is
2
, and the ID number for server B is3
. Make a note of the ID numbers listed for your servers (they will likely be different than shown above).b. Run the following query to tell Centova Cast that server B is now hosting all of the accounts that were previously on server A:
UPDATE accounts SET rpchostid=SERVER_B_ID,ipaddress="SERVER_B_IPADDRESS" WHERE rpchostid=SERVER_A_ID;
Replace
SERVER_A_ID
andSERVER_B_ID
with the actual ID numbers for servers A and B, respectively, andSERVER_B_IPADDRESS
with the IP address for server B.For example, using our example above where server A's ID number was 2, server B's ID number was 3, and server B's IP address was 10.10.0.51, our query would look like:
-- Example only, do not use verbatim! UPDATE accounts SET rpchostid=3,ipaddress="10.10.0.51" WHERE rpchostid=2;
Start Centova Cast on server B:
/etc/init.d/centovacast start
At this point, your streams should be ready to use on server B. Login to your web interface and test the streams hosted on server B to make sure that they are working.