charm-percona-cluster/templates/my.cnf

117 lines
3.1 KiB
INI

# Juju managed file - don't change as charm will overwrite your changed!
[mysqld]
# Never resolve IP's to hostnames; it adds overhead
# and is not really reliable for use with ACL's.
skip-name-resolve
{% if bind_address %}
bind-address = {{ bind_address }}
{% endif %}
{% if wsrep_provider_options %}
wsrep_provider_options = {{ wsrep_provider_options }}
{% endif %}
datadir=/var/lib/mysql
user=mysql
pid_file = /var/run/mysqld/mysqld.pid
# Path to Galera library
wsrep_provider=/usr/lib/libgalera_smm.so
# Add address of other cluster nodes here
# Cluster connection URL contains the IPs of node#1, node#2 and node#3
# Empty when bootstrapping the cluster
wsrep_cluster_address=gcomm://{{ cluster_hosts }}
# In order for Galera to work correctly binlog format should be ROW
binlog_format=ROW
{% if enable_binlogs -%}
log_bin={{ binlogs_path }}
expire_logs_days={{ binlogs_expire_days }}
max_binlog_size={{ binlogs_max_size }}
{% endif %}
# MyISAM storage engine has only experimental support
default_storage_engine=InnoDB
# This is a recommended tuning variable for performance
innodb_locks_unsafe_for_binlog=1
# This changes how InnoDB autoincrement locks are managed and is a requirement for Galera
innodb_autoinc_lock_mode=2
{% if innodb_file_per_table -%}
# This enables storing InnoDB tables in separate .ibd files. Note that, however
# existing InnoDB tables will remain in ibdata file(s) unles OPTIMIZE is run
# on them. Still, the ibdata1 file will NOT shrink - a full dump/import of the
# data is needed in order to get rid of large ibdata file.
innodb_file_per_table = 1
{% else -%}
innodb_file_per_table = 0
{% endif %}
# This option is driven by via the tuning-level configuration option
# safest = 1 (default)
# fast = 2
# unsafe = 0
innodb_flush_log_at_trx_commit = {{ innodb_flush_log_at_trx_commit }}
{% if innodb_change_buffering -%}
innodb_change_buffering = {{ innodb_change_buffering }}
{% endif %}
{% if innodb_io_capacity -%}
innodb_io_capacity = {{ innodb_io_capacity }}
{% endif %}
# Node #1 address
wsrep_node_address={{ private_address }}
# SST method
wsrep_sst_method={{ sst_method }}
# Cluster name
wsrep_cluster_name={{ cluster_name }}
# Authentication for SST method
wsrep_sst_auth="sstuser:{{ sst_password }}"
{% if max_connections != -1 %}
max_connections = {{ max_connections }}
{% endif %}
# Align 5.5. behaviour with later 5.6 releases
max_connect_errors = 100
# Seconds before clearing idle connections
{% if wait_timeout != -1 %}
wait_timeout = {{ wait_timeout }}
{% endif %}
# Fine tuning
key_buffer_size = {{ key_buffer }}
table_open_cache = {{ table_open_cache }}
max_allowed_packet = 16M
# InnoDB buffer should consume 100% of the bytes of the dataset size
# query cache is not supported with Active/Active configuration
innodb_buffer_pool_size = {{ innodb_buffer_pool_size }}
{% if ipv6 -%}
[sst]
sockopt=,pf=ip6
{% endif %}
{% if lp1366997_workaround -%}
# Adding workaround for bug:
# https://bugs.launchpad.net/charms/+source/percona-cluster/+bug/1366997
# Note that this should only be required for percona 5.5
wsrep_drupal_282555_workaround = ON
wsrep_retry_autocommit = 100
{% endif %}
!includedir /etc/mysql/conf.d/