Re-initialise when restarting 1-node cluster

Modify the mysql restart handler so that the arg '--wsrep-new-cluster'
is supplied when restarting a cluster of one node.

This fixes an issue where restarting a single-node cluster fails because
there are no other members of the cluster available with which to
re-establish a connection.

Change-Id: I2cdc1e61dde68e441c6927f85123467568df5e27
This commit is contained in:
git-harry 2016-03-09 15:32:27 +00:00
parent a05631b483
commit 24a6f1fea8
1 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@
state: restarted
sleep: 2
pattern: mysql
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) | ternary('--wsrep-new-cluster', '') }}"
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) or (groups['galera_all'] | length == 1) | ternary('--wsrep-new-cluster', '') }}"
environment:
MYSQLD_STARTUP_TIMEOUT: 180
when: not galera_running_and_bootstrapped | bool
@ -46,7 +46,7 @@
state: restarted
sleep: 2
pattern: mysql
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) | ternary('--wsrep-new-cluster', '') }}"
args: "{{ (not galera_existing_cluster | bool and inventory_hostname == galera_server_bootstrap_node) or (groups['galera_all'] | length == 1) | ternary('--wsrep-new-cluster', '') }}"
environment:
MYSQLD_STARTUP_TIMEOUT: 180
when: galera_restart | failed