Difference between revisions of "User:Mgpalmer"

From MythTV Official Wiki
Jump to: navigation, search
m (Moving my mythconverg to a remote MySQL server)
m
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
My mythtv software system is [http://g-ding.tv/ MythDora 5.0].
+
My current mythtv system has a combined backend/frontend and a 2nd frontend both based on Fedora 17 and the repository version of mythtv (0.26 fixes).
 +
 
 +
My previous mythtv system has a combined backend/frontend and a 2nd frontend both based on MythDora 12.23: [http://mythdora.com/ MythDora].
  
 
=My MythTV Systems=
 
=My MythTV Systems=
 
I've had a working MythTV system since about June 2006. My first working MythTV system was based on MythDora 2.32.
 
I've had a working MythTV system since about June 2006. My first working MythTV system was based on MythDora 2.32.
  
I currently have three systems now involved in my mythtv setup. The primary system is a combined backend/frontend running MythDora 4.0. In addition to this one I have a remote frontend only built from Jarod Wilson's guide, and a general support system serving (for mythtv) NFS and MySQL (on which mythconverg is running).
+
I currently have three systems now involved in my mythtv setup.
 +
* Primary system is a combined backend/frontend running MythDora 10.21.
 +
* Remote frontend only built with MythDora 10.21.
  
As well, I've set up a MythDora system for our daughter's household, and another for a friend.
 
 
==Main Frontend/Backend==
 
==Main Frontend/Backend==
 
As of May 2007 my primary system is a combined backend/frontend running on:
 
As of May 2007 my primary system is a combined backend/frontend running on:
Line 17: Line 20:
 
* Hauppauge PVR500 dual analog tuner card
 
* Hauppauge PVR500 dual analog tuner card
 
* AverMedia A180 dvb - viewing ATSC on DirecPath (DirecTV reseller for multi dwelling units)
 
* AverMedia A180 dvb - viewing ATSC on DirecPath (DirecTV reseller for multi dwelling units)
The A180 captures the few digital channels present on my cable (see below). The PVR500 works out great since I have quite limited space for PCI cards.
+
The A180 currently sits idle. The PVR500 works out great since I have quite limited space for PCI cards.
The user interface includes:
 
* MCE USB remote (bundled with PVR500)
 
* Logitech Cordless Desktop EX110 (mouse & keyboard)
 
* [[ViewSonic N3751w]] 37" LCD display
 
* Yamaha HTR-5835 DTS 5.1
 
  
 
==Remote Front End==
 
==Remote Front End==
My wife's computer in our home office is dual boot Windows XP Pro and Fedora 7 Linux. The Fedora 7 system is set up primarily for mythtv use, and was set up using Jarod Wilson's excellent [http://wilsonet.com/mythtv/fcmyth.php instructions]. Only minor deviations from his instructions were necessary.
+
An earlier mythtv system is now recycled for frontend only duty, allowing me to move the main unit out of the living room. It is configured with MythDora 10.21.
  
 
The hardware includes
 
The hardware includes
 
* Biostar NVIDIA GeForce 6100-M9
 
* Biostar NVIDIA GeForce 6100-M9
* AMD64 3800
+
* AMD64 single core
 
* 1 GB PC3200 DDR (2x 512MB modules in dual channel mode)
 
* 1 GB PC3200 DDR (2x 512MB modules in dual channel mode)
(Yes, the same as my primary backend, so it also serves as backup hardware.)
+
* nVidia 6200, DVI-HDMI cable
==General Server==
+
 
I've resurected an older computer system to use as a general purpose Linux based home server in order to:
+
The user interface includes:
* off load some activity from my MythTV system
+
* MCE USB remote (bundled with PVR500)
* learn more about some types of distributed systems
+
* Logitech Cordless Desktop EX110 (mouse & keyboard)
* and, well, because I can.
+
* ViewSonic N3751w 37" LCD display (HDMI inputs now dead after storm)
 +
* Yamaha HTR-5835 DTS 5.1
  
Services specific to mythtv listed here.
+
==Digital Content - Channels==
===NFS===
+
DirecPath have discontinued putting these signals on the cable ~ Feb 2009.
My MythDora system mounts the following from NFS:
+
Currently have an OTA capable tuner, but poor signal reception; I seem to be in a fringe area, and antenna options are quite limited in my apartment.
/storage/music/
 
/storage/pictures/
 
/storage/posters/
 
/storage/videos/
 
Local storage on my MythDora system is limited to only the program recordings and temp directories.
 
  
===MySQL===
+
Previously I could receive the following digital (ATSC) channels directly from the cable connection:
My MySQL database is running on a remote server now. Details below.
 
  
=My Digital Content=
 
==Channels==
 
The digital channels I'm able to receive currently include:
 
 
* 2-1 WSB-DT
 
* 2-1 WSB-DT
 
* 2-2 WSB-DT 2
 
* 2-2 WSB-DT 2
Line 58: Line 48:
 
* 11-1 WXIA-DT  
 
* 11-1 WXIA-DT  
 
* 46-1 WGCL-HD
 
* 46-1 WGCL-HD
 
These channels come on my DirecPath wire as ATSC encodings.
 
  
 
=To Do=
 
=To Do=
 
Things I'd like to do next:
 
Things I'd like to do next:
* Separate the main system using a mini hardware setup for FE
+
* Improve digital OTA reception
* RAID-5 NAS for more robust storage
 
* Dedicated FE for office, to include display panel & remote
 
 
* Net boot my frontends
 
* Net boot my frontends
  
Line 71: Line 57:
 
Just for grins and skills I decided to set up a remote Linux server on which to run MySQL. Here are the things I did to get this working. This is Fedora centric, as MythDora is built on Fedora.
 
Just for grins and skills I decided to set up a remote Linux server on which to run MySQL. Here are the things I did to get this working. This is Fedora centric, as MythDora is built on Fedora.
  
One advantage to having the database on a remote system is that it now running on a different disk spindle, so disk thrashing is reduced.
+
One advantage to having the database on a remote system is that it now running on a different disk spindle, so disk thrashing is reduced. Another advantage is there is less chance of hosing my database during system updates/upgrades.
 +
 
 
==Setup MySQL==
 
==Setup MySQL==
 
First, set up the database server machine. Install MySQL. It looks like mythtv-0.21 will be dropping MySQL v3 and v4 support. Ensure you use v5 of MySQL.
 
First, set up the database server machine. Install MySQL. It looks like mythtv-0.21 will be dropping MySQL v3 and v4 support. Ensure you use v5 of MySQL.

Latest revision as of 13:40, 27 March 2013

My current mythtv system has a combined backend/frontend and a 2nd frontend both based on Fedora 17 and the repository version of mythtv (0.26 fixes).

My previous mythtv system has a combined backend/frontend and a 2nd frontend both based on MythDora 12.23: MythDora.

My MythTV Systems

I've had a working MythTV system since about June 2006. My first working MythTV system was based on MythDora 2.32.

I currently have three systems now involved in my mythtv setup.

  • Primary system is a combined backend/frontend running MythDora 10.21.
  • Remote frontend only built with MythDora 10.21.

Main Frontend/Backend

As of May 2007 my primary system is a combined backend/frontend running on:

  • Biostar NVIDIA GeForce 6100-M9
  • AMD64 x2 4200
  • 2 GB PC3200 DDR (4x 512MB modules in dual channel mode)

I've reduced the storage to a single drive:

  • 500 GB Seagate SATA/300 HD - I'm running LVM and xfs on my /storage partition preallocating 512 MB for files with good success so far.

For capturing content I have two tuners:

  • Hauppauge PVR500 dual analog tuner card
  • AverMedia A180 dvb - viewing ATSC on DirecPath (DirecTV reseller for multi dwelling units)

The A180 currently sits idle. The PVR500 works out great since I have quite limited space for PCI cards.

Remote Front End

An earlier mythtv system is now recycled for frontend only duty, allowing me to move the main unit out of the living room. It is configured with MythDora 10.21.

The hardware includes

  • Biostar NVIDIA GeForce 6100-M9
  • AMD64 single core
  • 1 GB PC3200 DDR (2x 512MB modules in dual channel mode)
  • nVidia 6200, DVI-HDMI cable

The user interface includes:

  • MCE USB remote (bundled with PVR500)
  • Logitech Cordless Desktop EX110 (mouse & keyboard)
  • ViewSonic N3751w 37" LCD display (HDMI inputs now dead after storm)
  • Yamaha HTR-5835 DTS 5.1

Digital Content - Channels

DirecPath have discontinued putting these signals on the cable ~ Feb 2009. Currently have an OTA capable tuner, but poor signal reception; I seem to be in a fringe area, and antenna options are quite limited in my apartment.

Previously I could receive the following digital (ATSC) channels directly from the cable connection:

  • 2-1 WSB-DT
  • 2-2 WSB-DT 2
  • 5-1 WAGA-HD Fox
  • 11-1 WXIA-DT
  • 46-1 WGCL-HD

To Do

Things I'd like to do next:

  • Improve digital OTA reception
  • Net boot my frontends

Moving my mythconverg to a remote MySQL server

Just for grins and skills I decided to set up a remote Linux server on which to run MySQL. Here are the things I did to get this working. This is Fedora centric, as MythDora is built on Fedora.

One advantage to having the database on a remote system is that it now running on a different disk spindle, so disk thrashing is reduced. Another advantage is there is less chance of hosing my database during system updates/upgrades.

Setup MySQL

First, set up the database server machine. Install MySQL. It looks like mythtv-0.21 will be dropping MySQL v3 and v4 support. Ensure you use v5 of MySQL.

After installing, set mysqld to run at boot time, and turn it on now:

# chkconfig mysqld on
# service mysqld start

Then change the root password for MySQL:

# mysql -u root mysql
mysql> update user set Password=PASSWORD('ROOT_PWD') where user='root';
mysql> flush privileges;
mysql> quit

Get a copy of mc.sql from your mythtv machine. I found mine at

/usr/share/doc/mythtv-docs-0.20.2/database/mc.sql

Then put it in the database with

$ mysql -u root -p < /your/path/to/mc.sql

(This will prompt you for the mysql-root password.)

Add a mythtv user to your mysql install. http://dev.mysql.com/doc/refman/5.0/en/adding-users.html

Move any other config stuff you might have. I'm using Jarod's recommended my.cnf additions. From his site:

Under the [mysqld] section add:

key_buffer = 16M
table_cache = 128
sort_buffer_size = 2M
myisam_sort_buffer_size = 8M
query_cache_size = 16M

Additionally, I added a mythtv user to my Linux server system and edited the uid/gid values to be the same as on the MythDora system (1000/1000). This makes for more readable file owner/groups on both systems, especially as the same server holds my NFS partitions.

Prepare a database dump

The following occurs on the mythtv backend system that is currently running the database. At this point I shut down my mythtv system so that the database would not be changed during the following steps. I also ran the database optimizer.

# killall mythfrontend
# service mythbackend stop
# /usr/local/bin/optimize_mythdb.pl

I then dumped the database and turned off the mysqld server on this system.

$ mysqldump -u myth_user -p --extended-insert --databases mythconverg > mythdb.sql
# service mysqld stop
# chkconfig mysqld off

Load mythconverg on new server

After transfering this backup file to the new MySQL server machine, I was ready to import it to the new MySQL server.

$ mysql -u root -p mythconverg < mythdb.sql
(this will prompt for the mysql root user's password)

And allow mythtv to have remote access to this database with

$ mysql -u root -p mythconverg
(prompts for password)
mysql> grant all on mythconverg.* to mythtv@"%" identified by "mythtv";
mysql> flush privileges;
mysql> quit;

Configure mythbackend to use remote database

We're finally ready to bring it all together. Back on the mythtv backend system you need to configure access for the remote MySQL database server and restart mythbackend.

Access to the MySQL server on my MythDora system was configured in the mysql.txt file, found on my system in several places: /.mythtv/mysql.txt, /root/.mythtv/mysql.txt, and ~mythtv/.mythtv/mysql.txt. The change to make is

DBHostName=<mysql_server_name_or_IP>

I made this change to all 3 copies of mysql.txt found on my system.

Now I restarted the backend and frontend and verified all was well.

# service mythbackend start
$ mythfrontend
(watch some recordings, etc.)

Convert filing system from ext3 to xfs

MythDora automatically creates an LVM partition for the major storage of mythtv mounted as /storage, and formats it as ext3. xfs is a better performing filing system for large files. Here's how I converted my /storage to xfs.


Important.png Note: Must be root for the following

Converting MythDora /storage to xfs:

* be root
* make sure to have xfs-tools installed (if needed: # yum install xfsprogs)
* shut down access to /storage (myth[front|back]end, maybe mysql, etc., or init 1)
* unmount any NFS mounts
* cp -a /storage (to a safe place on another volume)
* mkfs.xfs /storage
* cp -a (saved /storage to) /storage
* edit /etc/fstab to account for the new fs type
* restart stuff (myth[front|back]end, etc., or init 5)

I used a feature of xfs to preallocate disk space in 512 MB increments. This reduces the total number of extents that a file will consume, especially with multiple files growing (more than 1 program recording simultaneously). This was accomplished with this line in my fstab:

/dev/sdb1    /storage    xfs    defaults, allocsize=512m 0 0

Files created after this change will contain far fewer extents than previously. Verify with

$ cd /storage/recordings
$ filefrag <file_name>

Add Another Disk to /storage LVM

At install time MythDora creates recording space for MythTV in a separate partition configured as LVM and mounted on /storage. Once disk space started filling up and I began losing shows before they were watched, I found this to be quite useful. Here's how I added a new disk to my system's /storage. I've done this both for an ext3 formatted /storage (default configuration) and an xfs formatted /storage.

I first made sure to watch up as much TV as possible and delete everything I could to minimize the time required to backup and restore data. These instructions assume you've already installed the disk into the computer chassis and performed any data backup you will be doing.

Warning.png Warning: If your mythtv data (or pictures, music, etc.) in /storage is important to you, then make sure to perform a backup beforehand.

You may need to unmount /storage. This will require stopping mythfrontend and mythbackend, as well as any other processes that might be using this partition.

# killall mythfrontend
# /sbin/service mythbackend stop 
# umount /storage

If you have trouble with this, then try single user mode:

# init 1

Get volume group name with mount and lvdisplay, which look something like this:

# mount
...
/dev/mapper/VolGroup00-LogVol01 on /storage type xfs (rw,allocsize=512m)
...
# lvdisplay /dev/VolGroup00/LogVol01
  --- Logical volume ---
  LV Name                /dev/VolGroup00/LogVol01
  VG Name                VolGroup00
  LV UUID                rEftR4-7mDC-6Vng-IyHO-a1eM-w15F-FlN1bA
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                453.72 GB
  Current LE             14519
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:1

On MythDora 3.2 I found the volume group name to be videovg instead.

Use pvcreate to initialize the device for use with LVM. You will need your device name; on my system it was /dev/sdb.

# pvcreate /dev/sdb

Use vgextend to add this device to the volume group.

# vgextend VolGroup00 /dev/sdb

Then use lvextend to make the new space available. You'll need to know how much space you have to add.

# pvs /dev/sdb
# lvextend -L +465.75G /dev/VolGroup00/LogVol01

Now for formatting. With xfs formatting you only need:

# xfs_growfs /storage

While for ext2/3 you'll need a more involved procedure.

single user mode: init 1 (since otherwise the volume group is busy)
unmount the volume group: umount /dev/videovg/videolv01
force checking disc: e2fsck -f /dev/videovg/videolv01
resize the volume group: resize2fs /dev/videovg/videolv01
remount: mount /dev/videovg/videolv01
check: df -h
return to multiuser mode: init 5
OR reboot: init 6