Fix MariaDB bootstrap for 10.1 version
Option "wsrep_on" behaves differently between 10.0 and 10.1 [1]: "Before MariaDB 10.1, even though this variable is ON by default, its value get automatically adjusted based on whether mandatory configurations to turn on Galera replication have been specified. Since MariaDB 10.1, it is set to OFF by default and must be turned on to enable Galera replication." So on MariaDB 10.0 although wsrep_on set to OFF, its value will automatically adjusted to ON because wsrep mandatory configurations are set. Whereas on MariaDB 10.1, it will failed at galera provider 'wsrep_ready' checking because wsrep_on is set to OFF. We can set wsrep_on to ON to handle both 10.0 and 10.1. But, the point is that the cluster bits, which are creating a cluster and wsrep_ready checking, are no need at bootstrap stage. At bootstrap stage it mainly do two things: Creating required system DBs (by mysql_install_db) and securing the mariadb (by bootstrap_db). After the bootstrap stage, it will create a cluster when starting the first node. [1] https://mariadb.com/kb/en/library/galera-cluster-status-variables/#wsrep_ready Partial-Bug: 1740060 Co-Authored-By: Steven Dake <stdake@cisco.com> Change-Id: Ia2acb09e877a586243fc1acb49d8d140cf27d7b5
This commit is contained in:
parent
bee9ea39ff
commit
6ff3a55aed
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
function bootstrap_db {
|
||||
mysqld_safe --wsrep-new-cluster --skip-networking --wsrep-on=OFF --pid-file=/var/lib/mysql/mariadb.pid &
|
||||
mysqld_safe --skip-networking --wsrep-on=OFF --pid-file=/var/lib/mysql/mariadb.pid &
|
||||
# Wait for the mariadb server to be "Ready" before starting the security reset with a max timeout
|
||||
# NOTE(huikang): the location of mysql's socket file varies depending on the OS distributions.
|
||||
# Querying the cluster status has to be executed after the existence of mysql.sock and mariadb.pid.
|
||||
@ -16,21 +16,7 @@ function bootstrap_db {
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
# NOTE(sbezverk): Currently kolla-kubernetes does not use Galera and disables wsrep driver.
|
||||
# This check will run only for non kolla-kubernetes bootstrap deployments.
|
||||
if [[ ! "${!KOLLA_KUBERNETES[@]}" ]]; then
|
||||
CLUSTER_READY=$(mysql -u root --exec="SHOW STATUS LIKE 'wsrep_ready'" | grep ON)
|
||||
TIMEOUT=${DB_MAX_TIMEOUT:-60}
|
||||
while [[ -z "${CLUSTER_READY}" ]]; do
|
||||
CLUSTER_READY=$(mysql -u root --exec="SHOW STATUS LIKE 'wsrep_ready'" | grep ON)
|
||||
if [[ ${TIMEOUT} -gt 0 ]]; then
|
||||
let TIMEOUT-=1
|
||||
sleep 1
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
sudo -E kolla_security_reset
|
||||
mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;"
|
||||
mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;"
|
||||
|
Loading…
x
Reference in New Issue
Block a user