How to set storage group weighting?

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Post Reply
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

How to set storage group weighting?

Post by mattlach »

Hey all,

I read about weighting here.

What I can't seem to figure out is where I edit these values. Is there a config file somewhere on the back end I need to edit?

Any thoughts appreciated!

Thanks,
Matt
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
User avatar
bill6502
Developer
Posts: 2325
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: How to set storage group weighting?

Post by bill6502 »

Hi,

They can be changed with the wget in that section. As the note says, there is no GUI to change them.
FYI, I've never changed the defaults.
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

Re: How to set storage group weighting?

Post by mattlach »

bill6502 wrote:Hi,

They can be changed with the wget in that section. As the note says, there is no GUI to change them.
FYI, I've never changed the defaults.
Thank you,

I saw that, but it confused the hell out of me.

I've been using Linux as my primary system since college in 2002, and I've never used wget to configure anything before, just to download files from the internet... For my servers I'm used to just using vim (or some other editor) from the command line, to edit some config file in /etc for settings like these. I'm not sure at all what that example does, which fields I need to edit in order to get my desired results or where I even run it from (presumably on the backend, but since I don't know what it is doing, maybe it's the frontend?)

I guess what I was hoping for was a little bit more detailed description about how this works, so I don't do something wrong and screw it up.

The reason I am looking to change the weighting is that I am doing long term storage on a NAS, but for some reason while it can read and write multiple recordings just fine, if you are writing and reading the same file (like when recording and watching something at the same time) I get lots of stuttering. I've recorded six streams, and watched two at the same time (but different files) with no problem at all, so the issue is confusing me.

My plan is to do a workaround. I'm going to have a fast local SSD for all live and scheduled recordings, and then a cron job that moves files with a timestamp older than a couple of hours to NAS at some time of the day when it's not in use. (4:30am?)

In order for mythtv to still be able to read (and autoexpire, etc) files, I need both the local SSD and the NAS in the defined storage directories, but I need to make sure that the weighting is such that it NEVER tries to record directly to the NAS.

Thanks,
Matt
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
User avatar
bill6502
Developer
Posts: 2325
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: How to set storage group weighting?

Post by bill6502 »

The wget is using the MythTV Services API to change the data in the settings table. It is a slightly safer method than using mysql and does no error checking of the data supplied. You need to use wget because thr Services API endpoints that change things must be a POST as opposed to using a browser where you're sending a GET (the reason for the --post argument in the command.) See: http://www.mythtv.org/wiki/Myth_Service if you want a bit more information.
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

Re: How to set storage group weighting?

Post by mattlach »

bill6502 wrote:The wget is using the MythTV Services API to change the data in the settings table. It is a slightly safer method than using mysql and does no error checking of the data supplied. You need to use wget because thr Services API endpoints that change things must be a POST as opposed to using a browser where you're sending a GET (the reason for the --post argument in the command.) See: http://www.mythtv.org/wiki/Myth_Service if you want a bit more information.

Thank you for that.

So just to make sure I have this right. So this is the example:

Code: Select all

BE=server2
SG_DIR=/mnt/video
VALUE=99
wget --post-data="HostName=${BE}&Key=SGweightPerDir:${BE}:${SG_DIR}&Value=${VALUE}" \
     http://${BE}:6544/Myth/PutSetting
If my backend hostname is "myth" and I want to set /mnt/FreeNAS/livetv to something impossibly high (like 99) I'd ssh into my backend and run the following?

Code: Select all

BE=myth
SG_DIR=/mnt/FreeNAS/livetv
VALUE=99
wget --post-data="HostName=${BE}&Key=SGweightPerDir:${BE}:${SG_DIR}&Value=${VALUE}" \
     http://${BE}:6544/Myth/PutSetting
If I have multiple folders under /mnt/FreeNAS, is it sufficient to run it once for the mountpoint, or should I run it once for every one of the subfolders in the mountpoint which are defined as storage directories using the backend gui?

Then, can I also run a follow up for my local ssd, and give it a really low number (like -19?)

Much obliged,
Matt
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
User avatar
bill6502
Developer
Posts: 2325
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: How to set storage group weighting?

Post by bill6502 »

You may need to wait for a dev to weigh in here, but I read the Wiki as saying your local SSD would default to -19, so no need to change it. Same answer for your using /mnt/FreeNAS. I read the Wiki as requiring a directory that exists in a Storage Group.

Your version of the script looks good to me, there could be a reason that 'myth' wouldn't work. The 1st ${BE} in the wget is the hostname used by MythTV as a "profile name". And, I suspect in most cases, it matches the hostname of the server it runs on. However, by changing a line in config.xml, the "profile name" can be changed. I doubt that that's the case, but a simple check would be to do the following from a browser:

Code: Select all

myth:6544/Myth/GetHostName
.

The result will look like: <String>yourMythTVHostnameWhichIsLikekyToBemyth</String>. Probably a waste of time, but it can't hurt.
User avatar
dekarl
Developer
Posts: 228
Joined: Thu Feb 06, 2014 11:01 pm
Germany

Re: How to set storage group weighting?

Post by dekarl »

mattlach wrote:The reason I am looking to change the weighting is that I am doing long term storage on a NAS, but for some reason while it can read and write multiple recordings just fine, if you are writing and reading the same file (like when recording and watching something at the same time) I get lots of stuttering. I've recorded six streams, and watched two at the same time (but different files) with no problem at all, so the issue is confusing me.

My plan is to do a workaround. I'm going to have a fast local SSD for all live and scheduled recordings, and then a cron job that moves files with a timestamp older than a couple of hours to NAS at some time of the day when it's not in use. (4:30am?)

In order for mythtv to still be able to read (and autoexpire, etc) files, I need both the local SSD and the NAS in the defined storage directories, but I need to make sure that the weighting is such that it NEVER tries to record directly to the NAS.
You can set your default and livetv storage groups to contain only the SSD, then add a separate "long term storage group" with the NAS storage. When MythTV doesn't find a file in the expected storage group it will search all known storage groups. That way you always write to the SSD but read from SSD and NAS without using undocumented settings. See also Mike's explanation on the users' list.
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

Re: How to set storage group weighting?

Post by mattlach »

dekarl wrote:You can set your default and livetv storage groups to contain only the SSD, then add a separate "long term storage group" with the NAS storage. When MythTV doesn't find a file in the expected storage group it will search all known storage groups. That way you always write to the SSD but read from SSD and NAS without using undocumented settings. See also Mike's explanation on the users' list.
This is fantastic, thank you very much. Will try this now!

--Matt
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

Re: How to set storage group weighting?

Post by mattlach »

Follow up question:

I currently have separate folders for recordings (default) and livetv (livetv) so that live tv viewings don't show up when I browse my recordings from the front end.

Currently the system seems to be able to know when I hit record while watching live TV, and these show up as recordings.

If I move the contents of livetv and recordings to my archive group, will the backend still be smart enough to only present the intentionally recorded shows when browsing recordings, or will everything (5 minutes of this show, 2 minutes of another, etc. etc.) show up?

Also, will LiveTV snippets still auto expire once moved to the new location?

Thank you,
Matt
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

Re: How to set storage group weighting?

Post by mattlach »

Ugh,

Now I am not sure what happened.

I created a archive storage group and moved all my recordings there. Success. Everything can still play back.

Then I edited the locations of LiveTV and Default to point to my local SSD.

/mnt/live_recordings/livetv

and

/mnt/live_recordings/recordings

Now Live TV has stopped working in all front ends. It still plays previously recorded shows from the new archive locations, but whenever you try to play live TV the screen flashes black, and then it just quits back to the main menu again.

I have double, triple and quadruple checked for typos in the directory locations, I have checked write permissions for the new folders.

Any ideas what might be going on here?

Thanks,
Matt
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

Re: How to set storage group weighting?

Post by mattlach »

Solved it.

I'm a moron. I forgot that mythtv backend runs under the mythtv user, not my main user account, myth.... So i set up all the mountpoint ownership for the myth user, not the mythtv user.

That being said, I don't recall having to change this last time...
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
User avatar
dekarl
Developer
Posts: 228
Joined: Thu Feb 06, 2014 11:01 pm
Germany

Re: How to set storage group weighting?

Post by dekarl »

mattlach wrote:I currently have separate folders for recordings (default) and livetv (livetv) so that live tv viewings don't show up when I browse my recordings from the front end.

Currently the system seems to be able to know when I hit record while watching live TV, and these show up as recordings.

If I move the contents of livetv and recordings to my archive group, will the backend still be smart enough to only present the intentionally recorded shows when browsing recordings, or will everything (5 minutes of this show, 2 minutes of another, etc. etc.) show up?

Also, will LiveTV snippets still auto expire once moved to the new location?
Only the storage location should be related to the LiveTV Storage Group. The other special handling of LiveTV recordings should be bound to the LiveTV Recording Group. (There are also Playback Groups for setting up things like 1.2x timestretch for talk shows, or similar.)
mattlach
Senior
Posts: 125
Joined: Wed Jun 11, 2014 2:52 am
United States of America

Re: How to set storage group weighting?

Post by mattlach »

dekarl wrote: Only the storage location should be related to the LiveTV Storage Group. The other special handling of LiveTV recordings should be bound to the LiveTV Recording Group. (There are also Playback Groups for setting up things like 1.2x timestretch for talk shows, or similar.)
Got it! Thank you for clearing that up.

--Matt
v33 backend in 22.04 LTS w. LXDE, in LXC on server w. 16C/32T Xeon E5-2650v2, 256GB RAM. 6C & 8GB assigned to container.
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Re: How to set storage group weighting?

Post by PhilB »

I’ve been following this debate and I’d like to throw in a question.

I’d be interested in installing an SSD to reduce noise, vibration and heat with it holding the usual suspects of root plus database and also a default recording partition. I’d retain a big HDD for the bulk of recordings, and dekarl on 11th July helpfully pointed out the slick the way to do this.

Others have suggested a strategy of moving only the older recordings to HDD. My variant would be to create recordings on SSD and have a regular job (a user job?) to copy all to HDD immediately. The SSD would thus have recent recordings only; the HDD all. This would mean that failure of either device would leave at least the recent recordings available.

I’m aware that I’d have to address a number of issues such as copying the files, removal of any second copies after recording deletion, managing space on the SSD and expiring very old recordings from the HDD. My question is whether the presence of the duplicated recordings on both SSD and HDD would cause problems? I can imagine find_orphans.py might be confused but what about Mythtv?

Phil
Post Reply