Sfoglia il codice sorgente

Merge branch 'master' into pr/27

pr/27
Petr Michalec 7 anni fa
parent
commit
10e3fbd96b
8 ha cambiato i file con 1088 aggiunte e 39 eliminazioni
  1. +930
    -0
      galera/files/grafana_dashboards/mysql_prometheus.json
  2. +46
    -19
      galera/master.sls
  3. +6
    -1
      galera/meta/grafana.yml
  4. +22
    -0
      galera/meta/prometheus.yml
  5. +19
    -0
      galera/meta/telegraf.yml
  6. +11
    -5
      galera/server.sls
  7. +50
    -14
      galera/slave.sls
  8. +4
    -0
      metadata/service/support.yml

+ 930
- 0
galera/files/grafana_dashboards/mysql_prometheus.json Vedi File

@@ -0,0 +1,930 @@
{
"annotations": {
"enable": false,
"list": []
},
"editable": true,
"gnetId": null,
"graphTooltip": 1,
"hideControls": false,
"id": null,
"links": [],
"refresh": "1m",
"rows": [
{
"collapse": false,
"height": 250,
"panels": [
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"datasource": null,
"description": "Displays the number of nodes in the cluster.",
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"id": 32,
"interval": null,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"nullText": null,
"postfix": "",
"postfixFontSize": "50%",
"prefix": "",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"span": 2,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"expr": "mysql_wsrep_cluster_size{host=\"$host\"}",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "",
"metric": "mysql_wsrep_cluster_size",
"refId": "A",
"step": 60
}
],
"thresholds": "",
"title": "Cluster size",
"type": "singlestat",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"description": "Displays the average sizes of receive and send queues.",
"fill": 0,
"id": 31,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 5,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "mysql_wsrep_local_recv_queue_avg{host=\"$host\"}",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "receive",
"refId": "A",
"step": 10
},
{
"expr": "mysql_wsrep_local_send_queue_avg{host=\"$host\"}",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "send",
"refId": "B",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Queues",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"description": "Displays the rate of flow control events.",
"fill": 0,
"id": 33,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 5,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "irate(mysql_wsrep_flow_control_recv{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "receive",
"metric": "",
"refId": "A",
"step": 10
},
{
"expr": "irate(mysql_wsrep_flow_control_sent{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "send",
"refId": "B",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Flow control",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "Replication",
"titleSize": "h6"
},
{
"collapse": false,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 0,
"id": 26,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "irate(mysql_bytes_received{host=\"$host\"}[1m])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "rx",
"metric": "",
"refId": "A",
"step": 10
},
{
"expr": "irate(mysql_bytes_sent{host=\"$host\"}[1m])",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "tx",
"metric": "",
"refId": "B",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Network I/O",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "Bps",
"label": "",
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 0,
"id": 27,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "irate(mysql_table_locks_immediate{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "immediate",
"refId": "A",
"step": 10
},
{
"expr": "irate(mysql_table_locks_waited{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "waited",
"refId": "B",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Locks",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 0,
"id": 28,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "mysql_threads_cached{host=\"$host\"}",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "cached",
"refId": "A",
"step": 10
},
{
"expr": "mysql_threads_connected{host=\"$host\"}",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "connected",
"refId": "B",
"step": 10
},
{
"expr": "mysql_threads_running{host=\"$host\"}",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "running",
"refId": "D",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Threads",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"id": 34,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "irate(mysql_queries{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "queries",
"refId": "A",
"step": 10
},
{
"expr": "irate(mysql_questions{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "questions",
"refId": "B",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Queries",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": "",
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 0,
"id": 29,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "irate(mysql_commands_commit{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "commit",
"refId": "A",
"step": 10
},
{
"expr": "irate(mysql_commands_delete{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "delete",
"refId": "B",
"step": 10
},
{
"expr": "irate(mysql_commands_insert{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "insert",
"refId": "C",
"step": 10
},
{
"expr": "irate(mysql_commands_select{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "select",
"refId": "D",
"step": 10
},
{
"expr": "irate(mysql_commands_rollback{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "rollback",
"refId": "E",
"step": 10
},
{
"expr": "irate(mysql_commands_update{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "update",
"refId": "F",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Commands",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 0,
"id": 30,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"span": 6,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "irate(mysql_handler_commit{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "commit",
"refId": "A",
"step": 10
},
{
"expr": "irate(mysql_handler_delete{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "delete",
"refId": "B",
"step": 10
},
{
"expr": "irate(mysql_handler_write{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "write",
"refId": "C",
"step": 10
},
{
"expr": "irate(mysql_handler_rollback{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "rollback",
"refId": "E",
"step": 10
},
{
"expr": "irate(mysql_handler_update{host=\"$host\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "update",
"refId": "F",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Handlers",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
],
"repeat": null,
"repeatIteration": null,
"repeatRowId": null,
"showTitle": true,
"title": "MySQL",
"titleSize": "h6"
}
],
"schemaVersion": 14,
"sharedCrosshair": true,
"style": "dark",
"tags": [],
"templating": {
"enable": true,
"list": [
{
"allFormat": "glob",
"allValue": null,
"current": {},
"datasource": "prometheus",
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "host",
"options": [],
"query": "label_values(mysql_connections,host)",
"refresh": 1,
"refresh_on_load": true,
"regex": "",
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"collapse": false,
"enable": true,
"notice": false,
"now": true,
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"status": "Stable",
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
],
"type": "timepicker"
},
"timezone": "browser",
"title": "MySQL",
"version": 33
}

+ 46
- 19
galera/master.sls Vedi File

@@ -63,6 +63,37 @@ galera_overide:
- require:
- pkg: galera_packages

{%- elif grains.get('init', None) == "systemd" %}

galera_systemd_directory_present:
file.directory:
- name: /etc/systemd/system/mysql.service.d
- user: root
- group: root
- mode: 755
- require:
- pkg: galera_packages

galera_override_limit_no_file:
file.managed:
- name: /etc/systemd/system/mysql.service.d/override.conf
- contents: |
[Service]
LimitNOFILE=1024000
- require:
- pkg: galera_packages
- file: galera_systemd_directory_present
- watch_in:
- service: galera_service

mysql_restart_systemd:
module.wait:
- name: service.systemctl_reload
- watch:
- file: /etc/systemd/system/mysql.service.d/override.conf
- require_in:
- service: galera_service

{%- endif %}

galera_conf_debian:
@@ -108,11 +139,12 @@ galera_pre_config:
- require_in:
- pkg: galera_packages

{%- if not grains.get('noservices', False) %}

galera_init_start_service:
cmd.run:
- name: /usr/local/sbin/galera_init.sh
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- file: galera_run_dir
- file: galera_init_script
@@ -121,24 +153,26 @@ galera_init_start_service:
galera_bootstrap_set_root_password:
cmd.run:
- name: mysqladmin password "{{ master.admin.password }}"
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- cmd: galera_init_start_service

mysql_bootstrap_update_maint_password:
cmd.run:
- name: mysql -u root -p{{ master.admin.password }} -e "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '{{ master.maintenance_password }}';"
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- cmd: galera_bootstrap_set_root_password

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

{%- endif %}

galera_bootstrap_init_config:
file.managed:
@@ -146,29 +180,24 @@ galera_bootstrap_init_config:
- source: salt://galera/files/my.cnf.init
- mode: 644
- template: jinja
{%- if not grains.get('noservices', False) %}
- require:
- service: galera_bootstrap_stop_service
{%- endif %}

{%- if not grains.get('noservices', False) %}

galera_bootstrap_start_service_final:
cmd.run:
- name: /usr/local/sbin/galera_bootstrap.sh
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- file: galera_bootstrap_init_config
- file: galera_bootstrap_script

{%- endif %}

galera_bootstrap_finish_flag:
file.touch:
- name: /var/lib/mysql/.galera_bootstrap
{%- if not grains.get('noservices', False) %}
- require:
- cmd: galera_bootstrap_start_service_final
{%- endif %}
- watch_in:
- file: galera_config

@@ -180,18 +209,16 @@ galera_config:
- source: salt://galera/files/my.cnf
- mode: 644
- template: jinja
{%- if not grains.get('noservices', False) %}
- require_in:
- service: galera_service
{%- endif %}

{%- if not grains.get('noservices', False) %}

galera_service:
service.running:
- name: {{ master.service }}
- enable: true
- reload: true
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}

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

+ 6
- 1
galera/meta/grafana.yml Vedi File

@@ -1,5 +1,10 @@
dashboard:
galera:
galera_prometheus:
datasource: prometheus
format: json
template: galera/files/grafana_dashboards/mysql_prometheus.json
galera_influxdb:
datasource: influxdb
format: json
template: galera/files/grafana_dashboards/mysql_influxdb.json
main:

+ 22
- 0
galera/meta/prometheus.yml Vedi File

@@ -0,0 +1,22 @@
{% raw %}
server:
alert:
GaleraNodeNotReady:
if: 'mysql_wsrep_ready != 1'
for: 1m
labels:
severity: warning
service: mysql
annotations:
summary: 'Galera on {{ $labels.host }} not ready'
description: 'The Galera service on {{ $labels.host }} is not ready to serve queries.'
GaleraNodeNotConnected:
if: 'mysql_wsrep_connected != 1'
for: 1m
labels:
severity: warning
service: mysql
annotations:
summary: 'Galera on {{ $labels.host }} not connected'
description: 'The Galera service on {{ $labels.host }} is not connected to the cluster.'
{% endraw %}

+ 19
- 0
galera/meta/telegraf.yml Vedi File

@@ -0,0 +1,19 @@
{%- if pillar.galera is defined %}
{%- if pillar.galera.master is defined %}
{%- from "galera/map.jinja" import master with context %}
{%- set server = master %}
{%- elif pillar.galera.slave is defined %}
{%- from "galera/map.jinja" import slave with context %}
{%- set server = slave %}
{%- endif %}
{%- endif %}

{%- if server is defined %}
agent:
input:
mysql:
address: {{ server.socket }}
username: {{ server.admin.user }}
password: {{ server.admin.password }}
tagexclude: [server]
{%- endif %}

+ 11
- 5
galera/server.sls Vedi File

@@ -70,7 +70,6 @@ restore_mysql_database_{{ database_name }}:

{%- for user in server.get('users', []) %}
{%- for host in user.get('hosts', user.get('host', 'localhost'))|sequence %}
{%- if not grains.get('noservices', False) %}
mysql_user_{{ user.name }}_{{ host }}:
mysql_user.present:
- host: '{{ host }}'
@@ -85,7 +84,10 @@ mysql_user_{{ user.name }}_{{ host }}:
#- connection_user: {{ connection.user }}
#- connection_pass: {{ connection.password }}
#- connection_charset: {{ connection.charset }}

{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
{%- if 'grants' in user %}
mysql_user_{{ user.name }}_{{ host }}_grants:
mysql_grants.present:
@@ -100,6 +102,9 @@ mysql_user_{{ user.name }}_{{ host }}_grants:
#- connection_charset: {{ connection.charset }}
- require:
- mysql_user_{{ user.name }}_{{ host }}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
{%- endif %}

{%- if 'databases' in user %}
@@ -118,12 +123,13 @@ mysql_user_{{ user.name }}_{{ host }}_grants_db_{{ db.database }}_{{ loop.index0
- require:
- mysql_user_{{ user.name }}_{{ host }}
- mysql_database_{{ db.database }}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
{%- endfor %}
{%- endif %}

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


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

+ 50
- 14
galera/slave.sls Vedi File

@@ -63,6 +63,37 @@ galera_overide:
- require:
- pkg: galera_packages

{%- elif grains.get('init', None) == "systemd" %}

galera_systemd_directory_present:
file.directory:
- name: /etc/systemd/system/mysql.service.d
- user: root
- group: root
- mode: 755
- require:
- pkg: galera_packages

galera_override_limit_no_file:
file.managed:
- name: /etc/systemd/system/mysql.service.d/override.conf
- contents: |
[Service]
LimitNOFILE=1024000
- require:
- pkg: galera_packages
- file: galera_systemd_directory_present
- watch_in:
- service: galera_service

mysql_restart_systemd:
module.wait:
- name: service.systemctl_reload
- watch:
- file: /etc/systemd/system/mysql.service.d/override.conf
- require_in:
- service: galera_service

{%- endif %}

galera_conf_debian:
@@ -107,11 +138,12 @@ galera_pre_config:
- require_in:
- pkg: galera_packages

{%- if not grains.get('noservices', False) %}

galera_init_start_service:
cmd.run:
- name: /usr/local/sbin/galera_init.sh
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- file: galera_run_dir
- file: galera_init_script
@@ -120,39 +152,45 @@ galera_init_start_service:
galera_bootstrap_set_root_password:
cmd.run:
- name: mysqladmin password "{{ slave.admin.password }}"
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- cmd: galera_init_start_service

mysql_bootstrap_update_maint_password:
cmd.run:
- name: mysql -u root -p{{ slave.admin.password }} -e "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '{{ slave.maintenance_password }}';"
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- cmd: galera_bootstrap_set_root_password

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

{%- endif %}

galera_bootstrap_init_config:
file.managed:
- name: {{ slave.config }}
- source: salt://galera/files/my.cnf
- mode: 644
- template: jinja
{%- if not grains.get('noservices', False) %}
- require:
- service: galera_bootstrap_stop_service
{%- endif %}

{%- if not grains.get('noservices', False) %}

galera_bootstrap_start_service_final:
cmd.run:
- name: /usr/local/sbin/galera_bootstrap.sh
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
- require:
- file: galera_bootstrap_init_config
- file: galera_bootstrap_script
@@ -167,7 +205,6 @@ galera_bootstrap_finish_flag:
- file: galera_config

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

galera_config:
file.managed:
@@ -175,18 +212,17 @@ galera_config:
- source: salt://galera/files/my.cnf
- mode: 644
- template: jinja
{%- if not grains.get('noservices', False) %}
- require_in:
- service: galera_service
{%- endif %}

{%- if not grains.get('noservices', False) %}
galera_service:
service.running:
- name: {{ slave.service }}
- enable: true
- reload: true
{%- endif %}

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

{%- endif %}


+ 4
- 0
metadata/service/support.yml Vedi File

@@ -13,3 +13,7 @@ parameters:
enabled: true
grafana:
enabled: true
prometheus:
enabled: true
telegraf:
enabled: true

Loading…
Annulla
Salva