[mythtv-users] Config backend for multiple frontends question

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Jul 22 01:24:57 UTC 2017


On Fri, 21 Jul 2017 17:27:09 -0400, you wrote:

>On 07/21/2017 04:35 PM, DryHeat122 . wrote:
>> Now that I have Mythbuntu upgraded to the latest version and working, I 
>> want to try and get a remote Raspberry Pi frontend working with it.  I 
>> know there have to be some changes in the backend and maybe some changes 
>> to mysql.  But I'm having trouble finding a comprehensive and up-to-date 
>> guide and have a couple of questions before I dive into this.
>> 
>> 1.  For the backend, I need to configure a static IP and enter it into 
>> both places (i.e. local and master backend) in the first screen of the 
>> BE setup.  Anything else I need to do for the BE?
>> 
>> 2.  For mysql, I found this guide 
>> <http://www.hackourlife.com/setting-up-multiple-remote-frontend-for-an-existing-mythtv-backend/>, 
>> but its 7 years old and I think config.xml format has changed since it 
>> was written.  Right now the mysql portion of my config.xml looks like this:
>> 
>> <Database>
>>      <Pinghost>1</Pinghost>
>>      <Host>localhost</Host>
>>      <UserName>mythtv</UserName>
>>      <Password>******</Password>
>>      <DatabaseName>mythconverg</DatabaseName>
>>      <Port>3306</Port>
>> </Database>
>> 
>> Do I need to make changes to this (for example localhost to the hard IP) 
>> or will setup take care of it when I modify the BE settings?  Do I need 
>> to change the grant and password like it says in that guide?  If so and 
>> I change the password do I need to update it in the config.xml too?
>> 
>> 3.  Any other changes needed besides BE setup and mysql?
>
>This comes up every few months. It came up a couple of weeks ago. I 
>wrote the following, but I am not sure I posted it.
>
>This is not really complicated, *but it is necessarily precise*.
>Tutorial starts. THERE WILL BE A TEST.
>
>There are logically *three* parts to a mythtv setup:
>1) the mysql database
>2) the backend service, and
>3) the frontend computer.
>
>These can be on different machines, in different times zones. But the 
>'usual' is to have all three parts on *one* box.
>A single machine setup can use a mysql socket to talk to the mysql 
>service, and not use networking at all.
>But if you have any part on another box, then networking must be 
>properly configured, the remote box must know where to look for the 
>mysql server, and for the master backend box.
>
>There are four* things which need to be correct for a remote frontend to 
>'talk' to a backend server.
>
>1)  On the remote frontend: the Mysql access address must be set.
>
>The remote machine needs to know *where* to contact the *mysql server*. 
>This is done through the config.xml file (usually at 
>$HOME/.mythtv/config.xml.) The config.xml file will be the same (except 
>for the local hostname) for ALL frontends talking to the same mysql 
>database. The remote mysql client will contact the master mysql database 
>settings table to obtain directions, as to where to find the backend.
>
>The remote box config.xml file needs this:
><Configuration>
>   <LocalHostName>remote-box-ip or name</LocalHostName>
>   <Database>
>     <PingHost>1</PingHost>
>     <Host>IP of mysql master server</Host>
>
>where 'LocalHostName' is the local machine (ie, the remote frontend) and 
>'Host' is the IP address of the MYSQL server (probably the same machine 
>as the mythtv backend, but not necessarily). All config.xml files will 
>be the same except for the LocalHostName entry.
>It is much easier to set up your boxen with static IP addresses by their 
>MAC address, on your router, and name versus IP in /etc/hosts. Then you 
>can use names throughout.
>
>2) The mysql server box (usually the master backend box) must allow 
>remote access and allow access by the remote mythtv user.
>
>he mysql service needs to be configured *to allow remote contact*. Most 
>distros install mysql or mariadb with networking disabled for security 
>reasons. You want something like the following in the /etc/my.cnf file 
>on the mysql database server machine:
>
>[mysqld]
># Disabling symbolic-links is recommended to prevent assorted security risks
>symbolic-links=0
>#skip-networking  # has to be OFF to allow external accesses
>#bind-address=127.0.0.1  # mysql cannot be bound to localhost!
>bind-address=192.168.99.99   #  your mysql server's address here
>
>Fix that file, and re-start the mysql service. (systemctl restart 
>mysqld.service)
>
>3) Remote Mysql user access
>On the mysql server machine, as root user, using the mysql database, add 
>your remote frontend user:
>
>mysql > GRANT ALL ON mythconverg.* TO mythtv@"192.168.99.10" IDENTIFIED 
>BY "mythtv";
>mysql > FLUSH PRIVILEGES;
>
>where 192.168.99.10 is the (static) address of the new frontend.
>Restart the mysql server. You should now be able access mysql from the 
>remote box using:
>mysql -h 192.168.99.99 -D mythconverg -u mythtv -pmythtv
>
>4)  Frontend access to the backend.
>Finally, run mythtv-setup on the new frontend and configure the settings 
>under 1.General. This section adds the remote frontend to the settings 
>table and defines the remote frontend instance. The entry which can 
>mislead you is 'Primary IP address/DNS name' which needs to be the 
>IP/name of the remote frontend you are configuring, NOT the master 
>backend server address. A remote frontend will not likely be the "Master 
>Backend", but that possibility is available (in case you upgrade the 
>machinery, etc.) So (generally) leave 'Master Backend' unchecked.
>
>Here endeth the tutorial. Any questions?  Yes, Bueller?
>The test is to get your own system working...
>
>Geoff
>
>*  Actually FIVE:  all the boxen must be running a mythtv version with 
>the same database schema. On error, no error message is given. Deducing 
>and correcting this failure is left as an exercise to the student.

You also need to ensure that mythbackend does not start before the
external network interfaces are up.  If it does, it fails to bind the
external IP addresses and instead falls back to using localhost, and
the frontends can not connect to it.  So the same fix is needed as
when you are using network tuners.


More information about the mythtv-users mailing list