Adding galera config file

Added galera.cnf to support configuration of galera setups. Defaults
were added for Fedora based on Fedora 23 configuration defaults.
This commit is contained in:
Tobias Jungel 2016-08-30 09:21:19 +02:00
parent f453abc465
commit 6e123c1017
3 changed files with 82 additions and 1 deletions

View file

@ -26,6 +26,19 @@ mysql_server_config:
{% endif %}
{% endif %}
{% if "galera_config" in mysql %}
mysql_galera_config:
file.managed:
- name: {{ mysql.config_directory + mysql.galera_config.file }}
- template: jinja
- source: salt://mysql/files/galera.cnf
{% if os_family in ['Debian', 'Gentoo', 'RedHat'] %}
- user: root
- group: root
- mode: 644
{% endif %}
{% endif %}
{% if "library_config" in mysql %}
mysql_library_config:
file.managed:

View file

@ -136,8 +136,11 @@ Fedora:
client: mariadb
service: mariadb
python: python2-mysql
config_directory: /etc/my.cnf.d/
config:
file: /etc/my.cnf.d/server.cnf
file: /etc/my.cnf
server_config:
file: server.cnf
sections:
mysqld_safe:
log_error: /var/log/mysqld.log
@ -149,6 +152,29 @@ Fedora:
port: 3306
bind_address: 127.0.0.1
symbolic_links: 0
galera_config:
file: galera.cnf
sections:
mysqld:
binlog_format: ROW
default-storage-engine: innodb
innodb_autoinc_lock_mode: 2
bind-address: 0.0.0.0
wsrep_provider: /usr/lib64/galera/libgalera_smm.so
wsrep_cluster_name: "my_wsrep_cluster"
wsrep_slave_threads: 1
wsrep_certify_nonPK: 1
wsrep_max_ws_rows: 131072
wsrep_max_ws_size: 1073741824
wsrep_debug: 0
wsrep_convert_LOCK_to_trx: 0
wsrep_retry_autocommit: 1
wsrep_auto_increment_control: 1
wsrep_drupal_282555_workaround: 0
wsrep_causal_reads: 0
wsrep_notify_cmd: noarg_present
wsrep_sst_method: rsync
wsrep_sst_auth: "root:"
openSUSE:
server: mariadb

42
mysql/files/galera.cnf Normal file
View file

@ -0,0 +1,42 @@
# DO NOT CHANGE THIS FILE!
# This config is generated by SALTSTACK
# and all change will be overrided on next salt call
{#-
===== FETCH DATA =====
-#}
{%- from "mysql/defaults.yaml" import rawmap with context -%}
{%- from "mysql/supported_sections.yaml" import supported_sections with context -%}
{%- set datamap = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:galera:lookup')) -%}
{#-
===== COMBINE DATA =====
-#}
{%- set goodParamList = datamap.galera_config.sections -%}
{%- for section_name in supported_sections -%}
{%- set sectdict = datamap.galera_config.sections[section_name] | default({}) -%}
{%- for mparam, mvalue in salt['pillar.get']('mysql:galera:'+section_name, {}).items() -%}
{%- set mparamUnderscore = mparam | replace('-','_') -%}
{%- do sectdict.update({mparamUnderscore:mvalue}) -%}
{%- endfor -%}
{%- do goodParamList.update({section_name:sectdict}) -%}
{%- endfor -%}
{#-
===== PRINT DATA =====
-#}
{%- for sname,sdata in goodParamList.items() -%}
{%- if sdata %}
[{{ sname }}]
{%- for mparam, mvalue in sdata.items()|default([])|sort -%}
{%- set indents = 40 - mparam|count %}
{% if mvalue == "noarg_present" -%}
{{ mparam }}
{% elif mvalue == "SETONPLEASE" %}
{{ mparam }}{{ '='|indent(indents, true) }} ON
{%- else -%}
{{ mparam }}{{ '='|indent(indents, true) }} {{ mvalue }}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endfor %}
{{ datamap.galera_config.append | default('') }}