Fix galera initialization with 10.4

For whatever reason, galera complains on startup about
wsrep_cluster_address missing even when mysql_install_db is run. By making
sure that we configure it before we initialize the database, the problems
seem to go away.
This commit is contained in:
Markus Mäkelä 2020-06-17 17:12:45 +03:00
parent 9fb5336615
commit 1756857f5d
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499

View File

@ -448,12 +448,14 @@ int Galera_nodes::start_galera()
for (int i = 0; i < N; i++)
{
// Remove the grastate.dat file
ssh_node(i, "rm -f /var/lib/mysql/grastate.dat", true);
ssh_node(i, "echo [mysqld] > cluster_address.cnf", true);
ssh_node_f(i, true, "echo wsrep_cluster_address=gcomm://%s >> cluster_address.cnf", gcomm.c_str());
ssh_node(i, "cp cluster_address.cnf /etc/my.cnf.d/", true);
ssh_node(i, "rm -rf /var/lib/mysql/*", true);
ssh_node(i, "mysql_install_db --user=mysql", true);
ssh_node_f(i,
true,
"sed -i 's/###NODE-ADDRESS###/%s/' /etc/my.cnf.d/* /etc/mysql/my.cnf.d/*;"
@ -467,7 +469,7 @@ int Galera_nodes::start_galera()
// Start the first node that also starts a new cluster
ssh_node_f(0, true, "galera_new_cluster");
for (int i = 0; i < N; i++)
for (int i = 1; i < N; i++)
{
if (start_node(i, "") != 0)
{