Comments - Using Healthcheck.sh
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
I had issues using
healthcheck.sh
as suggested by Bren X., because I set up MariaDB with a custom port 3307 directly within the MariaDB configuration, such as:This custom port collides with the default
healthcheck.sh
in Docker, that uses a file/var/lib/mysql/.my-healthcheck.cnf
generated similar to this:This file is passed as
--defaults-extra-file
to the MariaDB client.Overriding this file is not an option, as it contains a generated password.
What works, but is undocumented here, is, that
healthcheck.sh
also accepts parameters--defaults-file
and--defaults-extra-file
. By experiment, as the MariaDB client documentation is not that clear to me, it works passing--defaults-file
with reference to a file like this:It will override the port from the extra-file.
Now, extending the
test
section as given by Bren X., this extendedhealthcheck.sh
call would work for a file mounted to, for example,/etc/mysql/conf.d/custom-client.cnf
:There may be better options, like just sticking to the default port 3306 internally and use Docker to map it to 3307 to the outside. But at least, this approach works, and of course could also be used to pass other parameters to the MariaDB client.
The .my-healthcheck.cnf is generated from the configuration at initialization. If you remove the .my-healthcheck.sh and have MARIADB_AUTO_UPGRADE=1 then the .my-healthcheck.cnf will be regenerated with the currently configured port.
The healtcheck user/password will be regenerated in the server also with this option.