I'm attempting to install MariaDB Server 5.5 in a diskless image using Redhat Enterprise 7.8.
The problem I am running into is having a single diskless image with a single /etc/my.cnf
being deployed to all the nodes, which then are all pointed to the same data directory on the shared NFS storage.
What I would like to do is somehow have the /etc/my.cnf
determine which node it is on and write to a different directory on the shared storage (i.e. datadir = /sharednfs/output/node1,2,3,4/mariadb
). Is this possible?
From what I researched it looks like the only way would be to setup a separate diskless image for each node. I'm unable to find any parameters in my.cnf
that would allow a hostname variable or something of the sort.
I was able to get it to work by creating an override file for the mariadb systemd service and adding
ExecStart=/usr/bin/mysqld_safe --defaults-file=/nfspath/%H_my.cnf --basedir=/usr
Just to clarify, the --defaults-file option has to be the first argument in the line, it would not work otherwise. Thank you again for both of your inputs!
I don't have a RHEL system handy, but assuming it is pretty close to centos7.
Sure seems like you could easily handle this by overriding
mariadb.service
unit somehow.Perhaps add a
ExecStartPre
that adds a script that will replace the my.cnf with a symlink of/etc/my.cnf
to something like/nfspath/$(hostname -f)_my.cnf
.Or perhaps there is a way to just override the ExecStart. I don't think
$()
is valid here, but if it was something like this. Perhaps run it viash -c
?