Disable all uses of wsrep-provider in mysql_bootstrap container
authorDamien Ciabrini <dciabrin@redhat.com>
Thu, 14 Sep 2017 12:49:04 +0000 (14:49 +0200)
committerJuan Antonio Osorio Robles <jaosorior@redhat.com>
Wed, 20 Sep 2017 14:27:43 +0000 (14:27 +0000)
During the bootstrap of the mariadb database, galera replication
must be disabled while the users credentials are being set up. This
is done by setting wsrep-provider=none when starting mysqld_safe.

Icf67fd2fbf520e8a62405b4d49e8d5169ff3925b already disabled it
when the clustercheck credentials are being set up, but Kolla also
start a temporary server for setting up the root password.

Disable the setting directly at the end of the mysql.cnf in the
running container. That way, the default setting from galera.cnf will
be overriden, all mysqld_safe calls will disable WSREP and the setting
will stay ephemeral.

Change-Id: If14e22992b46a35a05a16a9db5ecb360ea13df8f
Closes-Bug: #1717250
(cherry picked from commit b0f50db80b10e9cd6263c4d6b3ca8dd818b658ba)

docker/services/pacemaker/database/mysql.yaml

index 4d5a0a1..9dace27 100644 (file)
@@ -159,6 +159,7 @@ outputs:
             detach: false
             image: {get_param: DockerMysqlImage}
             net: host
+            user: root
             # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
             command:
               - 'bash'
@@ -167,8 +168,9 @@ outputs:
                 list_join:
                   - "\n"
                   - - 'if [ -e /var/lib/mysql/mysql ]; then exit 0; fi'
-                    - 'kolla_start'
-                    - 'mysqld_safe --skip-networking --wsrep-on=OFF --wsrep-provider=none &'
+                    - 'echo -e "\n[mysqld]\nwsrep_provider=none" >> /etc/my.cnf'
+                    - 'sudo -u mysql -E kolla_start'
+                    - 'mysqld_safe --skip-networking --wsrep-on=OFF &'
                     - 'timeout ${DB_MAX_TIMEOUT} /bin/bash -c ''until mysqladmin -uroot -p"${DB_ROOT_PASSWORD}" ping 2>/dev/null; do sleep 1; done'''
                     - 'mysql -uroot -p"${DB_ROOT_PASSWORD}" -e "CREATE USER ''clustercheck''@''localhost'' IDENTIFIED BY ''${DB_CLUSTERCHECK_PASSWORD}'';"'
                     - 'mysql -uroot -p"${DB_ROOT_PASSWORD}" -e "GRANT PROCESS ON *.* TO ''clustercheck''@''localhost'' WITH GRANT OPTION;"'