| # All files in this package is subject to the GPL v2 license |
| # More information is in the COPYING file in the top directory of this package. |
| # Copyright (C) 2011 severalnines.com |
| {%- if pillar.galera.get('master',{}).get('enabled', False) %} |
| {%- from "galera/map.jinja" import master with context %} |
| {%- set service = master %} |
| {%- endif %} |
| {%- if pillar.galera.get('slave',{}).get('enabled', False) %} |
| {%- from "galera/map.jinja" import slave with context %} |
| {%- set service = slave %} |
| {%- endif %} |
| |
| [mysql] |
| {% if service.get('ssl', {}).get('enabled', False) %} |
| ssl-ca={{ service.ssl.ca_file }} |
| ssl-cert={{ service.ssl.cert_file }} |
| ssl-key={{ service.ssl.key_file }} |
| {% endif %} |
| |
| [mysqld_safe] |
| {%- if not service.get('error_log_enabled', False) %} |
| syslog |
| {%- endif %} |
| |
| [mysqld] |
| datadir=/var/lib/mysql |
| bind-address={{ service.bind.address }} |
| port=3306 |
| max_connections={{ service.max_connections }} |
| default-storage-engine=innodb |
| binlog_format=ROW |
| collation-server=utf8_general_ci |
| init-connect='SET NAMES utf8' |
| character-set-server=utf8 |
| default-storage-engine=innodb |
| {%- if service.get('error_log_enabled', False) %} |
| log_error = {{ service.get('error_log_path', '/var/log/mysql/error.log') }} |
| {%- endif %} |
| skip-external-locking |
| skip-name-resolve |
| socket = /var/run/mysqld/mysqld.sock |
| |
| myisam_sort_buffer_size=64M |
| wait_timeout={{ service.get('wait_timeout', 1800) }} |
| open_files_limit=102400 |
| table_open_cache={{ service.get('table_open_cache', 10000) }} |
| tmp_table_size={{ service.get('tmp_table_size', 16777216) }} |
| max_heap_table_size={{ service.get('max_heap_table_size', 16777216) }} |
| key_buffer_size=64M |
| max_allowed_packet=256M |
| query_cache_size=0 |
| query_cache_type=0 |
| |
| innodb_file_format=Barracuda |
| innodb_file_per_table=1 |
| innodb_buffer_pool_size={{ service.innodb_buffer_pool_size }} |
| innodb_log_file_size=627M |
| {% set threads_default = [grains.num_cpus * 2, 12] | sort | first %} |
| innodb_read_io_threads={{ service.innodb_read_io_threads if service.innodb_read_io_threads != 0 else threads_default }} |
| innodb_write_io_threads={{ service.innodb_write_io_threads if service.innodb_write_io_threads != 0 else threads_default }} |
| innodb_io_capacity=500 |
| innodb_flush_log_at_trx_commit=2 |
| innodb_flush_method=O_DIRECT |
| innodb_doublewrite=0 |
| innodb_autoinc_lock_mode=2 |
| innodb_locks_unsafe_for_binlog=1 |
| {%- if service.members|length > 1 %} |
| wsrep_cluster_address="gcomm://{% for member in service.members %}{{ member.host}}:4567{% if not loop.last %},{% endif %}{% endfor %}/?pc.wait_prim=no" |
| {%- else %} |
| wsrep_cluster_address="gcomm://" |
| {%- endif %} |
| wsrep_provider={{ service.wsrep_provider }} |
| wsrep_cluster_name="openstack" |
| |
| wsrep_slave_threads={{ service.wsrep_slave_threads if service.wsrep_slave_threads != 0 else threads_default }} |
| wsrep_sst_method=xtrabackup-v2 |
| wsrep_sst_auth={{ service.sst.get('user', service.admin.user) }}:{{ service.sst.get('password', service.admin.password) }} |
| wsrep_node_address={{ service.bind.address }} |
| |
| {% if service.get('ssl', {}).get('enabled', False) %} |
| {%- if service.ssl.ciphers is defined %} |
| {%- set _ciphers = [] %} |
| {%- for cipher_name, cipher in service.ssl.get('ciphers', {}).iteritems() %} |
| {%- if cipher.get('enabled', False) %} |
| {%- if cipher.name is defined %} |
| {%- do _ciphers.append(cipher.name) %} |
| {%- else %} |
| {%- do _ciphers.append(cipher_name) %} |
| {%- endif %} |
| {%- endif %} |
| {%- endfor %} |
| ssl_cipher={{ ':'.join(_ciphers) }} |
| {%- endif %} |
| ssl-ca={{ service.ssl.ca_file }} |
| ssl-cert={{ service.ssl.cert_file }} |
| ssl-key={{ service.ssl.key_file }} |
| {% endif %} |
| wsrep_provider_options=" |
| {%- if service.get('ssl', {}).get('enabled', False) -%} |
| socket.ssl=yes;socket.ssl_key={{ service.ssl.key_file }};socket.ssl_cert={{ service.ssl.cert_file }};socket.ssl_ca={{ service.ssl.ca_file }}; |
| {%- else -%} |
| gmcast.listen_addr = tcp://{{ service.bind.address }}:4567; |
| {%- endif %} |
| {%- if service.wsrep_provider_options is defined -%} |
| {% for opt,val in service.wsrep_provider_options.iteritems() %}{{ opt }}={{val}}{% if not loop.last %};{% endif %}{% endfor %} |
| {%- endif %}" |
| |
| [xtrabackup] |
| parallel={{ service.get('xtrabackup_parallel', 4) }} |
| |
| [sst] |
| streamfmt=xbstream |
| transferfmt=socat |
| sockopt=,nodelay,sndbuf=1048576,rcvbuf=1048576 |