Kodi Community Forum
kodi centralised database - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: kodi centralised database (/showthread.php?tid=368968)



kodi centralised database - JJarmush - 2022-07-19

I am running Kodi on different os machines. 
I have connected an usb 4TB disk to my ac1200 netgear router where I have stored all my movies so they are shared by any install I have.
That works well.
Needles to say I would like to centralize the databases in the same usb drive: it is the one on 24/7.

I may not install maria db on that usb drive according to the specs. Therefore the entire guide that allowed me to have a centralized db on my (dead) synology nas is not applicable.
Though I do not see why I may not have all files making the regular kodi db of one of my install moved to my usb disk.
Then I would need to include the right settings so all my installs point to that db location on the usb drive attached to my router. Any kodi install would run the same db files.
Am I missing anything ? Is there any risk should I run all my installs at once  ?
How do I implement that idea ?


RE: kodi centralised database - Klojum - 2022-07-19

(2022-07-19, 01:59)JJarmush Wrote: Though I do not see why I may not have all files making the regular kodi db of one of my install moved to my usb disk.
...
Am I missing anything ? Is there any risk should I run all my installs at once  ?

Singular SQLite database files (the default database type in Kodi) were never designed to be used by multiple users at the same time. A proper database server (MySQL, MariaDB) is still recommended. A simple Raspberry Pi device or an simple, old leftover PC can already do that for you, something a router with a shared USB drive typically is not capable of. So your 'dead' Synology NAS is not an option anymore? Also 'moving' your local database to an external location is (officially) not supported in Kodi.


RE: kodi centralised database - JJarmush - 2022-07-23

(2022-07-19, 05:16)Klojum Wrote:
(2022-07-19, 01:59)JJarmush Wrote: Though I do not see why I may not have all files making the regular kodi db of one of my install moved to my usb disk.
...
Am I missing anything ? Is there any risk should I run all my installs at once  ?

Singular SQLite database files (the default database type in Kodi) were never designed to be used by multiple users at the same time. A proper database server (MySQL, MariaDB) is still recommended. A simple Raspberry Pi device or an simple, old leftover PC can already do that for you, something a router with a shared USB drive typically is not capable of. So your 'dead' Synology NAS is not an option anymore? Also 'moving' your local database to an external location is (officially) not supported in Kodi.

Thank you for the precision but I would like a better understanding.
If I understand fully what you say you implies that Sqlite or any database is not only a passive structured data repository. Therefore it needs an executable that is capable to RECEIVE request from clients. If the database exe (RDBMS) is not running then a client may not open the database and perform any structured query. If it needs an executable to be run then an operating system needs to be running too and the limited OS provided by Netgear while allowing any file to be read on its attached disk, it is not enough functional to give access to the db.

Before receiving your answer ( thank you)I copied the whole DATA folder into the usb attached driver in question (where my movies are also stored) and I redirected the Kody path on my win user/appdata/roaming/kodi to the data folder (via a symlink) on the usbserver  /kodisrv that contains the sqlite db. I also connected to the usb drive another win machine in the same way. And apparently it worked: I put a watched mark on a movie using machine A that I found back when I launched kodi from the second machine. I have not tried yet but the same should go for my android tvbox if I redirect via xbmc.data=<path to the Kodi data folder you wish to use>.
I may have missed something but I am sure you have an answer to reconcile what I found. Would you expect a different behavior should I install MARIADB (also an RDBMS) with its files on the USB disk?
Any other comments advise ?
Thanks


RE: kodi centralised database - pkscout - 2022-07-24

(2022-07-23, 21:14)JJarmush Wrote: Any other comments advise ?

My only advice is "don't do this." SQL Lite is basically a file based db, and I don't think it has any way to deal with simultaneous writes. You might run along fine for awhile with multiple clients, but at some point two will try to write at the same time and likely corrupt the database.

As you said, it seems to work, so there's nothing stopping you. But this isn't in anyway supported. If you're going to insist on doing it, at least make regular backups of the databases.


RE: kodi centralised database - Klojum - 2022-07-27

(2022-07-23, 21:14)JJarmush Wrote: Thank you for the precision but I would like a better understanding.

In short: technically you can use the same SQLited database file by multiple Kodi devices, just never at the same time. If you can obey that rule at all times, then things should be fine.

A full-blown SQL server can run 24/7 with 1, 5, 74, 100's or more simultenous connections. Your router is not capable of running a SQL server.


RE: kodi centralised database - JJarmush - 2022-07-31

(2022-07-27, 12:36)Klojum Wrote:
(2022-07-23, 21:14)JJarmush Wrote: Thank you for the precision but I would like a better understanding.

In short: technically you can use the same SQLited database file by multiple Kodi devices, just never at the same time. If you can obey that rule at all times, then things should be fine.

A full-blown SQL server can run 24/7 with 1, 5, 74, 100's or more simultenous connections. Your router is not capable of running a SQL server.
Thank you both for your warnings. A full blown sqlserver...would you call it that way  a sqlserver that is run by a 128mb dd wrt router ?


RE: kodi centralised database - jbinkley60 - 2022-07-31

(2022-07-31, 03:26)JJarmush Wrote: Thank you both for your warnings. A full blown sqlserver...would you call it that way  a sqlserver that is run by a 128mb dd wrt router ?

Another option is to consider is a centralized media server that all clients talk to and runs 24x7.  They are designed for this type of use case.  It too will not run on your router but is a way to scale supporting many clients.  The Kodi Wiki has a few examples.  Here's one which I use and author the addon which talks to it and a Wiki page which explains a little more on how it works.  The whole Wiki has much more information.  This may not be what you had in mind but it is a way to solve the problem and may give you some other ideas.

As for a full blown SQL server like MS SQL Server, Oracle, Sybase similar are designed to run on a server that allows multi-user access.  As mentioned they do not use file based access and instead use an SQL protocol which then internally can do atomic level locking techniques like (row, page, table, object etc..) to allow many users to write to the database simultaneously.  Here's a good Microsoft article on SQL locking mechanisms.  Full blown SQL servers can become very expensive and complicated to operate.  The media server solutions I mention leverage SQLite databases but they are the only thing talking to the database and the mange write locking issues and such vs. all clients trying to talk to the underlying database individually and independently.




Jeff


RE: kodi centralised database - Klojum - 2022-07-31

Just for the nitpickers: Kodi only supports MySQL and MariaDB as database servers. The latter being a fork of the former. Any other 'SQL' servers (MS-SQL, Oracle, etc) are not suited for Kodi usage.