Description
When initiating, from a slave, the clone of another server, the command CLONE INSTANCE FROM will restart mysqld on the slave.
The command fails because the Docker image runs mysqld directly rather than through the mysqld_safe wrapper and so the clone_plugin cannot restart mysqld.
The entrypoint.sh script is useful because it pre-initialises the MySQL environment. It is a handy starting point for creating MySQL Group Replication clusters on-the-fly with Kubernetes but it is a little restrictive for use.
Two issues exist:
- The entrypoint.sh only works for mysqld and not mysqld_safe.
- There is logic to prevent entrypoint.sh being run from another script. I cannot create a Kubernetes initContainer that runs /entrypoint.sh to initialise the DB environment
My current workaround is to run this sed script in a Kubernetes initContainer to modify entrypoint not to run mysqld upon completion and invert the _is_sourced check, I'm therefore using entrypoint.sh to initialise the environment and leaving process control to the main mysql container in the Pod.
sed -e 's/exec "$@"/###/' -e 's/ _is_sourced;/ false;/' -i /entrypoint.sh
Suggested fix:
_main():
- support 'init' as an parameter to initialise the DB (as well as existing mysqld). I can therefore run
/entrypoint.sh init
from an initContainer. - don't run
exec "$@"
if"$1" == "init"
- drop the
_is_sourced
check that wraps the call to_main()
.
procps
is also an additional package dependency to use mysqld_safe