ansible-mysql/templates/etc/mysql/mariadb.conf.d/50-server.cnf.j2

142 lines
4.4 KiB
Django/Jinja

# -------------------------------------------
# {{ ansible_managed }}
# -------------------------------------------
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mariadbd daemon
[mariadbd]
#
# * Basic Settings
#
user = mysql
pid-file = {{ mariadb_pid_file }}
socket = {{ mariadb_socket }}
port = {{ mariadb_port }}
basedir = /usr
datadir = {{ mariadb_datadir }}
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
# Broken reverse DNS slows down connections considerably and name resolve is
# safe to skip if there are no "host by domain name" access grants
#skip-name-resolve
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = {{ mariadb_bind_address }}
#
# * Fine Tuning
#
key_buffer_size = {{ mariadb_key_buffer_size }}
max_allowed_packet = {{ mariadb_max_allowed_packet }}
#thread_stack = 192K
thread_cache_size = {{ mariadb_thread_cache_size }}
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#myisam_recover_options = BACKUP
max_connections = {{ mariadb_max_connections }}
#table_cache = 64
# Other tuning setting
table_open_cache = {{ mariadb_table_open_cache }}
sort_buffer_size = {{ mariadb_sort_buffer_size }}
read_buffer_size = {{ mariadb_read_buffer_size }}
read_rnd_buffer_size = {{ mariadb_read_rnd_buffer_size }}
myisam_sort_buffer_size = {{ mariadb_myisam_sort_buffer_size }}
#
# * Logging and Replication
#
# Note: The configured log file or its directory need to be created
# and be writable by the mysql user, e.g.:
# $ sudo mkdir -m 2750 /var/log/mysql
# $ sudo chown mysql /var/log/mysql
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# Recommend only changing this at runtime for short testing periods if needed!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
{% if mariadb_log_error == 'syslog' %}
syslog
syslog-tag = {{ mariadb_syslog_tag }}
{% else %}
log_error = {{ mariadb_log_error }}
{% endif %}
#
# Enable the slow query log to see queries with especially long duration
#log-queries-not-using-indexes
{% if mariadb_slow_query_log_enabled %}
slow_query_log_file = {{ mariadb_slow_query_log_file }}
long_query_time = {{ mariadb_slow_query_time }}
slow_query_log = 1
{% else %}
#slow_query_log_file = /var/log/mysql/mariadb-slow.log
#long_query_time = 10
#log_slow_rate_limit = 1000
#log_slow_verbosity = query_plan
{% endif %}
#
# * SSL/TLS
#
# For documentation, please read
# https://mariadb.com/kb/en/securing-connections-for-client-and-server/
#ssl-ca = /etc/mysql/cacert.pem
#ssl-cert = /etc/mysql/server-cert.pem
#ssl-key = /etc/mysql/server-key.pem
#require-secure-transport = on
#
# * Character sets
#
# MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# Most important is to give InnoDB 80 % of the system RAM for buffer use:
# https://mariadb.com/kb/en/innodb-system-variables/#innodb_buffer_pool_size
innodb_buffer_pool_size = {{ mariadb_innodb_buffer_pool_size }}
innodb_log_buffer_size = {{ mariadb_innodb_log_buffer_size }}
innodb_flush_log_at_trx_commit = {{ mariadb_innodb_flush_log_at_trx_commit }}
innodb_lock_wait_timeout = {{ mariadb_innodb_lock_wait_timeout }}
innodb_log_file_size = {{ mariadb_innodb_log_file_size }}
# this is only for embedded server
[embedded]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadbd]
# This group is only read by MariaDB-{{ __mariadb_version.stdout }} servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-{{ __mariadb_version.stdout }}]