From b5bdd4cfb71968f88398ab1f791868472399fdc6 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Fri, 6 Apr 2018 23:06:44 -0400 Subject: [PATCH] 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 --- templates/galera_secure_node.j2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/galera_secure_node.j2 b/templates/galera_secure_node.j2 index e8786dea..59b9ca5d 100644 --- a/templates/galera_secure_node.j2 +++ b/templates/galera_secure_node.j2 @@ -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"