Kodi Community Forum

Full Version: MySQL setup/config with multiple NAS boxes on same LAN.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I do apologise if this has been covered before.  I've spent several days trawling forums/guides/tutorials & I just can't find anything that covers what I need.  Any help or advice would be very much appreciated Smile.

First up, I've NEVER used MySQL or anything like it before, so please be gentle lol Wink . Don't go too mad with the whole tech aspect of it up front Wink.  I'm reasonably tech savvy but I'm certainly not an expert or advanced!!

Right now, I have 2 x Synology DS418 NAS boxes on my home network but that will hopefully be increased to 3 x DS418's over the coming days as well. (It's my understanding that I'd need to use MariaDB as the MySQL server on one of my Syno NAS's that would become the actual MySQL server, I've got that far). Additionally, I use the DSM Web UI to manage all aspects of the NAS's themselves, (no SSH/terminal based access etc.). Because I don't use SSH etc., PHPMyAdmin is going to be my best option there too rather than messing around (or messing up) with command lines.

All of my NAS boxes are on the same LAN/IP range. All of the devices that will be accessing the MySQL server once up & running will also be on the same LAN IP range only as well.  Every NAS or device on the LAN has a static IP as well.  If it affects MySQL config/access too, the firewalls on the NAS's are also enabled/configured to only allow LAN access. 

Obviously, I have several individual devices that are all running the same base version of Kodi (18). They've all been individually configured to have the same libraries from the sources/shares on my NAS boxes. However, it just isn't an option to keep each individual library updated to include the "my ratings" of my movie/TV show collection, or marking media as watched, tracking progress, etc., etc. manually.

As such.... I'd like to attempt setting up a centralised MySQL system.  I need the central system to keep track of "my ratings" across all client devices, (ratings that I give to movies in Kodi), marking media as watched across all devices, & tracking progress of any given movie or TV episode.

I've been reading/viewing several different online guides/tutorials for setting up MySQL, but they're all essentially guides for setting up MySQL with a single NAS!!! What I can't find is any info for setting up MySQL if multiple NAS's are in use.

How would that work please? How do I configure MySQL if I have media stored in several different directories across all three NAS boxes?

Presumably I still just use a single NAS as the actual MySQL server?  But, how do I then set things up so that the DB/library includes all of the media from all of the sources/shares across all three NAS boxes please?  (I need the central DB to basically include all of the media from all of my sources as it presently does from each individual Kodi device please.)

For example, do I need to add the IP's of each source NAS to the advancedsettings.xml files?  Or, will everything be done automatically when I carry out the first set up from Kodi, & the source NAS's will be added to the sources.xnl file too please?

I might have stood a chance of successfully setting up MySQL by myself if I was simply following a step by step tutorial & just using a single NAS lol . However, having multiple NAS's in use obviously complicates things.

Many thanks in advance for any help & info Smile.

Yours confusedly & kind regards Wink,
Wolfy.
I think you are over thinking this.  Lets assume your MySQL server is up and running and your are using smb. 

Nas1 : Hosts your MySQL server also has a shared movie folder named Movies1
IP: 192.168.2.1
From your main Kodi client add a movie source :  smb://192.168.2.1/Movies1

Nas2: has a shared movie folder named Movies2
IP: 192.168.2.2
From your main Kodi client add a movie source :  smb://192.168.2.2/Movies2

Nas3: has a shared movie folder named Movies3
IP: 192.168.2.3
From your main Kodi client add a movie source :  smb://192.168.2.3/Movies3
If it's that simple I've definitely been overthinking it all lol Wink.

Many thanks indeed for clarifying how it works Smile.
(2019-05-03, 18:13)Arctic_Wolf Wrote: [ -> ]If it's that simple I've definitely been overthinking it all lol Wink.

Many thanks indeed for clarifying how it works Smile.

No probs, I did the same thing what seems like 10 years ago.  It can be pretty intimidating at first but then it all makes sense after you set your first one up.
(2019-05-03, 18:41)helta Wrote: [ -> ]
(2019-05-03, 18:13)Arctic_Wolf Wrote: [ -> ]If it's that simple I've definitely been overthinking it all lol Wink.

Many thanks indeed for clarifying how it works Smile.

No probs, I did the same thing what seems like 10 years ago.  It can be pretty intimidating at first but then it all makes sense after you set your first one up. 
Many thanks Smile.
(2019-05-03, 18:41)helta Wrote: [ -> ]
(2019-05-03, 18:13)Arctic_Wolf Wrote: [ -> ]If it's that simple I've definitely been overthinking it all lol Wink.

Many thanks indeed for clarifying how it works Smile.

No probs, I did the same thing what seems like 10 years ago.  It can be pretty intimidating at first but then it all makes sense after you set your first one up.  


Many thanks Smile.
(2019-05-03, 18:41)helta Wrote: [ -> ]
(2019-05-03, 18:13)Arctic_Wolf Wrote: [ -> ]If it's that simple I've definitely been overthinking it all lol Wink.

Many thanks indeed for clarifying how it works Smile.

No probs, I did the same thing what seems like 10 years ago.  It can be pretty intimidating at first but then it all makes sense after you set your first one up. 

Not had a chance to set it all up yet but would you mind confirming something else for me please Smile?

In addition to Kodi MySQL tracking movies as watched & the watched progress  - Can it also store the "my ratings" of my media too?  (I.e. when you bring up the "information" of an individual movie, you can apply your own "my rating" (1 - 10).)

Are these ratings also tracked centrally?

(I have a large library & I rely heavily on my own ratings to recall which movies I've obviously enjoyed more than others.  Really need that feature centralised too if possible.  Is it automated too if available or would I need to an an extra line to the advancedsettings.xml for that to be tracked too for example?

Many thanks Smile.
(2019-05-11, 05:52)Arctic_Wolf Wrote: [ -> ]Are these ratings also tracked centrally?

Metadata is stored in the Kodi video database, local or centralized. User ratings are stored in both the 'episode' and 'movie' tables in a "userrating" field. Ratings gotten via their scraper is stored in a different table.

(2019-05-11, 05:52)Arctic_Wolf Wrote: [ -> ](I have a large library & I rely heavily on my own ratings to recall which movies I've obviously enjoyed more than others.  Really need that feature centralised too if possible.  Is it automated too if available or would I need to an an extra line to the advancedsettings.xml for that to be tracked too for example?

User ratings are also exported into nfo files when doing a Video Library Export (which can be considered a backup). Keeping backups of your own files, including your MySQL database, is still your responsibility. Smile
(2019-05-03, 00:38)Arctic_Wolf Wrote: [ -> ]For example, do I need to add the IP's of each source NAS to the advancedsettings.xml files?

When it comes to computer servers, it's very recommended that each of them keep their IP addresses in a network once the whole network is running. Changing IP addresses will confuse applications very quickly, including Kodi.

Personally I fixate all necessary IP addresses of network devices via my router, the device that issues the IP addresses via its DHCP server. Based on the unique MAC address that _every_ network device has worldwide, you can have your devices have the correct IP address all the time.

The big benefit: you don't have to dive into the network settings of each of your network devices and set an IP address manually. You can keep them at the default 'Auto DHCP' setting as the router will give them their pre-set IP address.
(2019-05-11, 10:06)Klojum Wrote: [ -> ]
(2019-05-11, 05:52)Arctic_Wolf Wrote: [ -> ]Are these ratings also tracked centrally?

Metadata is stored in the Kodi video database, local or centralized. User ratings are stored in both the 'episode' and 'movie' tables in a "userrating" field. Ratings gotten via their scraper is stored in a different table.
(2019-05-11, 05:52)Arctic_Wolf Wrote: [ -> ](I have a large library & I rely heavily on my own ratings to recall which movies I've obviously enjoyed more than others.  Really need that feature centralised too if possible.  Is it automated too if available or would I need to an an extra line to the advancedsettings.xml for that to be tracked too for example?

User ratings are also exported into nfo files when doing a Video Library Export (which can be considered a backup). Keeping backups of your own files, including your MySQL database, is still your responsibility. Smile 

That's great thanks.  Just what I needed to know Smile.
(2019-05-11, 10:18)Klojum Wrote: [ -> ]
(2019-05-03, 00:38)Arctic_Wolf Wrote: [ -> ]For example, do I need to add the IP's of each source NAS to the advancedsettings.xml files?

When it comes to computer servers, it's very recommended that each of them keep their IP addresses in a network once the whole network is running. Changing IP addresses will confuse applications very quickly, including Kodi.

Personally I fixate all necessary IP addresses of network devices via my router, the device that issues the IP addresses via its DHCP server. Based on the unique MAC address that _every_ network device has worldwide, you can have your devices have the correct IP address all the time.

The big benefit: you don't have to dive into the network settings of each of your network devices and set an IP address manually. You can keep them at the default 'Auto DHCP' setting as the router will give them their pre-set IP address. 

Agreed.  If I can't manually assign a static IP to any given device on my network, I also use my router to reserve IP's for them too.

With the number of devices I have it's much easier keeping track of them all with static/reserved IP's & as you say, it causes less confusion all round Smile.
(2019-05-11, 18:25)Arctic_Wolf Wrote: [ -> ]
(2019-05-11, 10:06)Klojum Wrote: [ -> ]
(2019-05-11, 05:52)Arctic_Wolf Wrote: [ -> ]Are these ratings also tracked centrally?

Metadata is stored in the Kodi video database, local or centralized. User ratings are stored in both the 'episode' and 'movie' tables in a "userrating" field. Ratings gotten via their scraper is stored in a different table.
(2019-05-11, 05:52)Arctic_Wolf Wrote: [ -> ](I have a large library & I rely heavily on my own ratings to recall which movies I've obviously enjoyed more than others.  Really need that feature centralised too if possible.  Is it automated too if available or would I need to an an extra line to the advancedsettings.xml for that to be tracked too for example?

User ratings are also exported into nfo files when doing a Video Library Export (which can be considered a backup). Keeping backups of your own files, including your MySQL database, is still your responsibility. Smile          

That's great thanks.  Just what I needed to know Smile.         

Many thanks for all of the advice so far, very much appreciated.  Mind if I pick your brains some more please though lol Smile ??  As you mentioned earlier, this whole thing is highly intimidating!!!  Honestly, after following some older guides I found online to achieve what I have so far, I really haven't got a clue what I'm doing with MySQL & PHPMyAdmin lol Wink!!!!!!

Basically, I am up & running.  As planned I've gone ahead & used my new third NAS as the MySQL server.  I manually installed the " Web Station" package onto my Syno DS418 NAS, then I installed MariaDB 10 which also automatically picked & installed PHP 5.6 at the same time!!  (Obviously, I also installed PHPMyAdmin too which thankfully now forces you to create a password for the initial root login, so I didn't have to mess around with that part.  I also successfully added my Kodi user/pass to PHPMyAdmin as well & I seem to have at least passed "go" but I don't know if I get my $200 (yet lol) Wink )??

However, there are 2 further PHP package options available, 7.0 & 7.2.  Is 5.6 the best option for Kodi &/or what I'm doing, or would I be better off with 7.0, or 7.2  please?

Otherwise, I started with a completely fresh install of Kodi (Android media hub) & I added the correctly configured advancedsettings.xml file before I ran Kodi for the first time.  From my EXTREMELY limited knowledge of PHPMyAdmin, my DB seems to have been successfully generated & as far as I can tell it's running well.  (I haven't yet added a second or third client device but I hope to do this soon.)

One thing I am concerned about is that it created the full DB so far from all of the media that was already on my designated sources, but I'm not sure if it's successfully adding new content to the DB when I add new media & scan it into the library in Kodi.

Example - I've been looking at my Kodi DB from PHPMyAdmin using the Tables & Views in the tree structure in the left pane.  I can see movies that are definitely there all listed alphabetically, but I'm not seeing movies in the DB from these views that were scanned into the library after the DB was created.

Is there anything extra I need to do please, or anything else that I'm missing in general?  Any general tips for first starting out with PHPMyAdmin as well please?

Again, thanks for all the help.  Anything further would be very much appreciated Smile.
(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]I really haven't got a clue what I'm doing with MySQL & PHPMyAdmin
There are always the "MySQL for Dummies" books, for those people interested in databases.

(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]then I installed MariaDB 10 which also automatically picked & installed PHP 5.6 at the same time!!
It's a weird combo IMHO. PHP 5.6 is old, MariaDB 10 is new.

(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]However, there are 2 further PHP package options available, 7.0 & 7.2.  Is 5.6 the best option for Kodi &/or what I'm doing, or would I be better off with 7.0, or 7.2  please?
PHP is for programming scripts which can be used on a webserver. It is not required for Kodi usage. PHP 5.6 is rather old, but still kept around, because the programming requirements are 'simpler' and plenty of people haven't yet upgraded or renewed their scripts for the more complex requirements of PHP 7.x . PHPMyAdmin requires PHP, but v5.6 is okay for it.

(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]Example - I've been looking at my Kodi DB from PHPMyAdmin using the Tables & Views in the tree structure in the left pane.
FYI: Tables in a database hold the actual records of your data. Views will output the data of one or more combined fields within on or more tables. So if you see all your movies in the 'movie' table in the MyVideos116 database, then those movies should be listed in the movie_view as well.

(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]Is there anything extra I need to do please, or anything else that I'm missing in general?
You really should do a bit of MySQL learning if you want to maintain a running database.
(2019-05-18, 23:47)Klojum Wrote: [ -> ]
(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]I really haven't got a clue what I'm doing with MySQL & PHPMyAdmin
There are always the "MySQL for Dummies" books, for those people interested in databases.
(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]then I installed MariaDB 10 which also automatically picked & installed PHP 5.6 at the same time!!
It's a weird combo IMHO. PHP 5.6 is old, MariaDB 10 is new.
(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]However, there are 2 further PHP package options available, 7.0 & 7.2.  Is 5.6 the best option for Kodi &/or what I'm doing, or would I be better off with 7.0, or 7.2  please?
PHP is for programming scripts which can be used on a webserver. It is not required for Kodi usage. PHP 5.6 is rather old, but still kept around, because the programming requirements are 'simpler' and plenty of people haven't yet upgraded or renewed their scripts for the more complex requirements of PHP 7.x . PHPMyAdmin requires PHP, but v5.6 is okay for it.
(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]Example - I've been looking at my Kodi DB from PHPMyAdmin using the Tables & Views in the tree structure in the left pane.
FYI: Tables in a database hold the actual records of your data. Views will output the data of one or more combined fields within on or more tables. So if you see all your movies in the 'movie' table in the MyVideos116 database, then those movies should be listed in the movie_view as well.
(2019-05-18, 19:23)Arctic_Wolf Wrote: [ -> ]Is there anything extra I need to do please, or anything else that I'm missing in general?
You really should do a bit of MySQL learning if you want to maintain a running database. 
Thanks again Smile.

Yup, lol, I really am going to have to study up more on it all in general.  I'm not that interested in learning about databases in all honesty, I just want/need to know enough about it for my multiple Kodi devices to be able to utilise the central DB effectively & efficiently Smile.

Thanks for clearing up the differences with the actual PHP packages/versions.  I'm not running any websites etc. off my NAS or anything like that, just this Kodi DB.  Will just have to hope 5.6 is kept around for some time to come to save me rebuilding from scratch again with a newer version lol Wink.

I'm definitely going to have to learn how to backup the DB etc. as well, just in case Wink!!  It's probably going to be a slow learning curve but will eventually master the basics to keep me running.  It is intimidating, there's no doubt about that, especially for those who've never used anything like it before.

I'm starting to find my way around PHPMyAdmin a little easier already, however.  I can see various information now that I was missing the first couple of times I looked through it Smile.

Fingers crossed that maintaining it all goes as smoothly as I actually managed to get it installed, & up & running.

Have a virtual beer on me Wink!!  Advice much appreciated Smile.