Backend migration

From MythTV Official Wiki
Revision as of 10:16, 26 May 2011 by JanCeuleers (talk | contribs) (Added a section on retiring an old backend, based on guidance from Michael T Dean in the users mailing list, which I have successfully tested.)

Jump to: navigation, search

Building a new backend to replace an existing machine

If you want to build a new master backend, and test it before taking it into service, then follow these steps:

  • Build the machine, install the OS, etc.
  • It is suggested that unless you have a dedicated network on which to test the new machine, to give it a new IP address and hostname.
  • Test the machine.

When you are ready to press the machine into service as the master backend:

  • Stop all frontend and backend processes on all machines.
  • Back up the database on your existing master backend.
  • Copy the resulting backup file to the new machine.
  • Restore the database on the new machine. Depending on how your distribution initialises the database upon installation of the backend, you may need to use the procedure for replacing the database by the backup.
  • Before doing anything else, if you used a different hostname for the new machine, change the hostname of the master backend.
  • Start up mythtv-setup and also change the master backend IP address on the General Settings page.
  • Copy all media (recordings, videos, music, etc) from the old machine to the same directory structure on the new machine.
  • Modify /etc/mythtv/mysql.txt and /etc/mythtv/config.xml on all machines to point to the new database server.
  • If your frontends NFS-mount anything from the master backend, change those mounts to point to the new backend.
  • Start the master backend and all mythtv processes on all machines.

Retiring an old backend

3 steps are required to (properly) retire a backend system:

  • Start mythtv-setup on the to-be-retired backend system and go to Capture Cards and select "Delete all capture cards on <hostname>" (use the "on <hostname>" option so you leave your cards on the other backends defined). Or, if you're physically moving cards to other hosts (and, therefore, need to re-connect all inputs to get them in the right order), this will be taken care of when you do the "Delete all capture cards" (to delete all cards from all hosts) before re-creating cards and re-connecting inputs). See, also, .
  • Still in mythtv-setup on the to-be-retired backend system, go into Storage Directories, and Delete each Storage Group (select the group and hit DELETE (by default, 'D')). If you've configured your system such that you've only defined Storage Groups on the master backend (and did not override any SG directory lists on remote backends), this step will be unnecessary. Note, though, that since MythVideo requires an explicit override of the Videos SG on each host, you probably have overrides that need deleting.
  • Update your database to tell mythbackend that a new host now owns the recordings from the to-be-retired backend host:
mysql -umythtv -p mythconverg -e "UPDATE recorded SET hostname = 'new_hostname' WHERE hostname = 'old_hostname';"

(fixing the host names as necessary). Eventually, we will have code that makes step #3 unnecessary. Currently, there's no code in MythTV to allow doing this, so you have to edit the DB directly--which means you take all the risks that doing so entails, so Database Backup and Restore. Mike would recommend a backup before/between making any of the above modifications just in case you make a mistake.