Start MySQL on localhost for galera_secure_node

When running MySQL on bare metal, it starts up the secure script
before configuring anything which means that it listens on all
interfaces by default.

In scenarios where the load balancer might be colocated with the
database server, it would cause a conflict and it would refuse
to start up (even if the database server is already configured
not to listen on that interface, the configuration only gets
dropped later in the play).

This sets the environment configuration to start it up on localhost
only and then resets it once it is done.  It should not affect
existing deployment but help with bare metal ones.

Change-Id: I883e32678ea3cc2eea09d23db5eecfce35aee6f2
This commit is contained in:
Mohammed Naser
2018-04-06 23:06:44 -04:00
parent feba22bfaa
commit b5bdd4cfb7

View File

@@ -19,6 +19,7 @@ STOP_MYSQL=false
if ! systemctl status mysql; then
STOP_MYSQL=true
systemctl set-environment MYSQLD_OPTS="--bind-address=127.0.0.1"
systemctl start mysql
sleep 10
systemctl status mysql
@@ -41,4 +42,5 @@ if [ "${STOP_MYSQL}" = true ]; then
fi
# Create a marker file to ensure this script is not run again
systemctl unset-environment MYSQLD_OPTS
touch "/var/lib/mysql/osa_default_secured"