Where my confusion lies is in two parts. The first is do I need to create a database and tables in the UnRaid MariaDB. If so what specifically needs to be done.
The second part is what should the mysql statement look like if my MariaDB on UnRaid is at 192.168.1.90:3306
For 1), you create the DB (only the DB, the tables will be created by HA), and user / password directly on mariadb, than GRANT all rights on that DB to that user
In the UnRaid MariaDB I created a database called hacore, with a username of homeassistant and a pasword of 123456789, as well as granting all privileges, just to see if I could make this work.
I then created in the recorder.yaml file the following line.
Please disregard my other posts, I seem to have it working.
At least it created 8 databases. I will have to monitor it.
I do not know what was wrong but after a dozen attempts, reboots, clearing of cache it started to work.
I then created a stronger db name and password and all seems well.
Thank you for the “push” on how to do it.
Hi @carltonb , did you migrate all your data across when you did this or start fresh? If you did migrate data, would love to know how you did (or if HA did it for you, particularly sensor history data).
Thanks!
I then went into the recoder.yaml file and added the following.
recorder:
# The number of days of history to keep in the recorder database
purge_keep_days: 3
# How often (in days) the purge task runs
# UPDATE v0.109 - to be removed in future Home Assistant version - disabled!
# purge_interval: 1
db_url: !secret mariadb_url
I then restarted HA and lo and behoold after about 5 minutes mariadb was AUTOMATICALLY populated with my data.
After a few days I went back and removed the homeassistant db file in config.
Everything works well.
So I have a simmilar situation with my unraid install.
Do you have your HA container running in a custom docker network or is it host/bridge mode?
I have my unraid as 192.168.1.10
HA is 192.168.1.2
my Mariadb is 192.168.1.10:3306 (customer docker network)
No matter what I do, I can’t get HA to connect to the mariadb container.
I’m losing my mind as everything seems correct but it’s clearly struggling.
My unraid server is at 192.168.1.90.
I am using a custom networkfor both HA Core and Mariadb (192.168.1.90:3306)
My HA Core is at 192.168.1.90, though that info does not show up on the docker unraid dashboard.
In my circumstance it works fine.
Thanks for the feedback, out of curiousity, what MariaDB image are you using?
I couldn’t get it working using the linuxserver, but worked fine using the eoffical image.
In case it helps the next fool who refuses to use another distro and wants to to overly complicate their lives here is how I got the linuxserver container working
I was able to get MariaDB (linuxserver) working on the docker network and HA working in bridge mode.
I had to go to settings - docker - stop docker - then enable
Allows direct communication between the host and containers using a custom macvlan network. By default this is disabled.
Enabling everything, HA was now able to connect to the container
MariaDB-Official didn’t need this change so it probably can be fixed another way
I am using the official linuxserver version.
I had no problems getting it up and running for my other software I use on unraid.
My original problem was I did not understand the Home Assistant instructions to get it working.
After the initial help in this thread it was “easy” for me.