{% set engine = pillar.galera.get('engine', 'mysql') %} # 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=1800 open_files_limit=102400 table_open_cache=10000 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 innodb_read_io_threads={{ service.get('innodb_read_io_threads', 8) }} innodb_write_io_threads={{ service.get('innodb_write_io_threads', 8) }} 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 wsrep_on=ON {%- 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.get('wsrep_slave_threads', 8) }} {%- if engine == 'mysql' %} wsrep_sst_method=xtrabackup-v2 wsrep_sst_auth={{ service.admin.user }}:{{ service.admin.password }} {%- endif %} wsrep_node_address={{ service.bind.address }} wsrep_provider_options="gcache.size = 256M" wsrep_provider_options="gmcast.listen_addr = tcp://{{ service.bind.address }}:4567" {% if service.get('ssl', {}).get('enabled', False) %} wsrep_provider_options="socket.ssl=yes;socket.ssl_key={{ service.ssl.key_file }};socket.ssl_cert={{ service.ssl.cert_file }};socket.ssl_ca={{ service.ssl.ca_file }}" {%- 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 %} [xtrabackup] parallel={{ service.get('xtrabackup_parallel', 4) }} [sst] streamfmt=xbstream transferfmt=socat sockopt=,nodelay,sndbuf=1048576,rcvbuf=1048576