Browse Source

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 years ago
parent
commit
954ef6f3fd
2 changed files with 38 additions and 11 deletions
  1. +19
    -4
      galera/master.sls
  2. +19
    -7
      galera/slave.sls

+ 19
- 4
galera/master.sls View File

- require: - require:
- pkg: galera_packages - pkg: galera_packages


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


galera_init_script: galera_init_script:
file.managed: file.managed:
- require: - require:
- cmd: galera_bootstrap_set_root_password - 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: galera_bootstrap_stop_service:
service.dead: service.dead:
- name: {{ master.service }} - name: {{ master.service }}
{%- if not grains.get('noservices', False) %}
- require: - require:
- cmd: mysql_bootstrap_update_maint_password
- cmd: galera_bootstrap_stop_service_pre
{%- else %}
- onlyif: /bin/false
{%- endif %}


galera_bootstrap_init_config: galera_bootstrap_init_config:
file.managed: file.managed:
- source: salt://galera/files/my.cnf.init - source: salt://galera/files/my.cnf.init
- mode: 644 - mode: 644
- template: jinja - template: jinja
- require:
- require:
- service: galera_bootstrap_stop_service - service: galera_bootstrap_stop_service


galera_bootstrap_start_service_final: galera_bootstrap_start_service_final:
- source: salt://galera/files/my.cnf - source: salt://galera/files/my.cnf
- mode: 644 - mode: 644
- template: jinja - template: jinja
- require_in:
- require_in:
- service: galera_service - service: galera_service


galera_service: galera_service:

+ 19
- 7
galera/slave.sls View File

{%- if grains.get('noservices') %} {%- if grains.get('noservices') %}
- onlyif: /bin/false - onlyif: /bin/false
{%- endif %} {%- endif %}
- require:
- require:
- file: galera_run_dir - file: galera_run_dir
- file: galera_init_script - file: galera_init_script


- require: - require:
- cmd: galera_bootstrap_set_root_password - 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: galera_bootstrap_stop_service:
service.dead: service.dead:
- name: {{ slave.service }} - name: {{ slave.service }}
{%- if grains.get('noservices') %}
{%- if not grains.get('noservices', False) %}
- require:
- cmd: galera_bootstrap_stop_service_pre
{%- else %}
- onlyif: /bin/false - onlyif: /bin/false
{%- endif %} {%- endif %}
- require:
- cmd: mysql_bootstrap_update_maint_password


galera_bootstrap_init_config: galera_bootstrap_init_config:
file.managed: file.managed:
- source: salt://galera/files/my.cnf - source: salt://galera/files/my.cnf
- mode: 644 - mode: 644
- template: jinja - template: jinja
- require:
- require:
- service: galera_bootstrap_stop_service - service: galera_bootstrap_stop_service


galera_bootstrap_start_service_final: galera_bootstrap_start_service_final:
{%- if grains.get('noservices') %} {%- if grains.get('noservices') %}
- onlyif: /bin/false - onlyif: /bin/false
{%- endif %} {%- endif %}
- require:
- require:
- file: galera_bootstrap_init_config - file: galera_bootstrap_init_config
- file: galera_bootstrap_script - file: galera_bootstrap_script


- source: salt://galera/files/my.cnf - source: salt://galera/files/my.cnf
- mode: 644 - mode: 644
- template: jinja - template: jinja
- require_in:
- require_in:
- service: galera_service - service: galera_service


galera_service: galera_service:

Loading…
Cancel
Save