Bläddra i källkod

Fixing galera bootstrap hang caused by incorrect mysql shutdown

command called by service.dead state:
systemd-run --scope systemctl stop mysql.service

More common way is to shut down service using known credentials

Change-Id: I2abe7eeea850333139587347039b1de8a6ea486f
pull/34/head
Dmitry Stremkovskiy 7 år sedan
förälder
incheckning
954ef6f3fd
2 ändrade filer med 38 tillägg och 11 borttagningar
  1. +19
    -4
      galera/master.sls
  2. +19
    -7
      galera/slave.sls

+ 19
- 4
galera/master.sls Visa fil

@@ -105,7 +105,7 @@ galera_conf_debian:
- require:
- pkg: galera_packages

{%- endif %}
{%- endif %}

galera_init_script:
file.managed:
@@ -166,11 +166,26 @@ mysql_bootstrap_update_maint_password:
- require:
- cmd: galera_bootstrap_set_root_password

galera_bootstrap_stop_service_pre:
cmd.run:
- name: mysqladmin -h localhost -u root -p{{ master.admin.password }} shutdown
{%- if not grains.get('noservices', False) %}
- ignore_retcode: true
- require:
- cmd: mysql_bootstrap_update_maint_password
{%- else %}
- onlyif: /bin/false
{%- endif %}

galera_bootstrap_stop_service:
service.dead:
- name: {{ master.service }}
{%- if not grains.get('noservices', False) %}
- require:
- cmd: mysql_bootstrap_update_maint_password
- cmd: galera_bootstrap_stop_service_pre
{%- else %}
- onlyif: /bin/false
{%- endif %}

galera_bootstrap_init_config:
file.managed:
@@ -178,7 +193,7 @@ galera_bootstrap_init_config:
- source: salt://galera/files/my.cnf.init
- mode: 644
- template: jinja
- require:
- require:
- service: galera_bootstrap_stop_service

galera_bootstrap_start_service_final:
@@ -207,7 +222,7 @@ galera_config:
- source: salt://galera/files/my.cnf
- mode: 644
- template: jinja
- require_in:
- require_in:
- service: galera_service

galera_service:

+ 19
- 7
galera/slave.sls Visa fil

@@ -144,7 +144,7 @@ galera_init_start_service:
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- require:
- file: galera_run_dir
- file: galera_init_script

@@ -166,14 +166,26 @@ mysql_bootstrap_update_maint_password:
- require:
- cmd: galera_bootstrap_set_root_password

galera_bootstrap_stop_service_pre:
cmd.run:
- name: mysqladmin -h localhost -u root -p{{ slave.admin.password }} shutdown
{%- if not grains.get('noservices', False) %}
- ignore_retcode: true
- require:
- cmd: mysql_bootstrap_update_maint_password
{%- else %}
- onlyif: /bin/false
{%- endif %}

galera_bootstrap_stop_service:
service.dead:
- name: {{ slave.service }}
{%- if grains.get('noservices') %}
{%- if not grains.get('noservices', False) %}
- require:
- cmd: galera_bootstrap_stop_service_pre
{%- else %}
- onlyif: /bin/false
{%- endif %}
- require:
- cmd: mysql_bootstrap_update_maint_password

galera_bootstrap_init_config:
file.managed:
@@ -181,7 +193,7 @@ galera_bootstrap_init_config:
- source: salt://galera/files/my.cnf
- mode: 644
- template: jinja
- require:
- require:
- service: galera_bootstrap_stop_service

galera_bootstrap_start_service_final:
@@ -190,7 +202,7 @@ galera_bootstrap_start_service_final:
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- require:
- file: galera_bootstrap_init_config
- file: galera_bootstrap_script

@@ -210,7 +222,7 @@ galera_config:
- source: salt://galera/files/my.cnf
- mode: 644
- template: jinja
- require_in:
- require_in:
- service: galera_service

galera_service:

Laddar…
Avbryt
Spara