[mythtv-users] Multiple hostname changes on DB restore?

Michael T. Dean mtdean at thirdcontact.com
Tue Nov 29 22:33:16 UTC 2011


On 11/29/2011 05:11 PM, Andrew Cranwell wrote:
> On 11/30/2011 4:35 AM, Michael T. Dean wrote:
>> On 11/29/2011 04:51 AM, Andrew Cranwell wrote:
>>> I'm currently importing the database from my old BE/FE and am at the
>>> point of updating the hostname; however, at some point in the distant
>>> past, I changed the hostname of the old backend without properly
>>> updating the database (yes, everything broke and I won't do it again).
>>>
>>> Is it "safe" to run `mythconverg_backup.pl --change-hostname` twice
>>> (once with each old hostname)? I tried it and got errors about duplicate
>>> values, so I'm hesitant to proceed with that unless told it's safe.
>>>
>>> Or should I try fixing the damage on the old BE and re-export/re-import
>>> the DB?
>> You'll need to re-restore the database you had before you started doing
>> the --change-hostname process.
>>
>> With --change-hostname, it's critical that the host name you select is
>> one that has never been used before.  There's no way to "merge" 2
>> different host names to a single name.
>>
>> With more details on the existing and desired names (and which should
>> map to which name), I could give you an exact procedure, but the most
>> challenging to figure out process would be getting an old definition of
>> a host name (say, myhost) out of the way and changing an old host name
>> (say oldhost) to be your good hostname (myhost).  For that, you need to
>> use a temporary "garbage" name.  So:
>>
>> myhost: old host name that was used before, but no longer has proper
>> settings
>> myhost: desired host name to use, but with proper settings
>> oldhost: old host name that was used before with the proper settings for
>> (new) myhost
>>
>> mythconverg_restore.pl --change_hostname --old_hostname="myhost"
>> --new_hostname="garbage"
>> mythconverg_restore.pl --change_hostname --old_hostname="oldhost"
>> --new_hostname="myhost"
>>
> The original hostname was "myth-primary-backend", and at some point it
> was changed to "myth-primary-backend.home". The new hostname is "myth2011".
>> Then just ignore "garbage"--unless the old myhost (now garbage) was a
>> backend host name and you actually recorded shows using that backend and
>> you've now moved those shows to another host, or you configured capture
>> cards/input connections or storage groups on that backend.  Then, you
>> would need to "retire" that backend (as described at
>> http://www.mythtv.org/wiki/Backend_migration ).
>>
> Since it's a replacement for the old backend, is there any way to ditch
> all the sources/inputs, settings, etc. and only import the recordings?

Best bet is a full restore, then go into mythtv-setup and do a "Delete 
all video sources", then reconfigure.  That won't reset settings to 
defaults, but settings are mainly just frontend preferences.  Those can 
be changed as you decide you don't like them.

> It's also a migration from 0.21 to 0.24, so the less old cruft the
> better (I took a backup of the clean 0.24 DB before I started).

If you started mythtv-setup or mythbackend to upgrade the 0.21 database 
to 0.24 on the new system (myth2011), then it created a new myth2011 
host, so that's why you can't change the old host name to myth2011 
(because that host already exists).  You need to change myth2011 to 
something else (like garbage) and then change the 
myth-primary-backend.home or whatever to myth2011.

That's what 
http://www.mythtv.org/wiki/Database_Backup_and_Restore#Change_the_hostname_of_a_MythTV_frontend_or_backend 
means by, "When changing the hostname of your system, you /must/ perform 
the following actions /before/ you start any MythTV programs."  (Note 
that eventually we'll have tools to allow you to delete old hosts, but 
until then, the old host settings are taking up /at most/ about 4kB of 
HDD space and won't affect performance at all.)

Mike


More information about the mythtv-users mailing list