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

142 lines
4.4 KiB
Plaintext
Raw Permalink Normal View History

2024-08-26 21:48:03 +07:00
# -------------------------------------------
# {{ ansible_managed }}
2024-08-26 21:48:03 +07:00
# -------------------------------------------
#
# 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]
2024-08-26 21:48:03 +07:00
# 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
2024-08-26 21:48:03 +07:00
# 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
#
2024-08-26 21:48:03 +07:00
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
#
2024-08-26 21:48:03 +07:00
# 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.
2024-08-26 21:48:03 +07:00
# Recommend only changing this at runtime for short testing periods if needed!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
2024-08-26 21:48:03 +07:00
#
# Error log - should be very few entries.
#
{% if mariadb_log_error == 'syslog' %}
syslog
syslog-tag = {{ mariadb_syslog_tag }}
{% else %}
2024-08-26 21:48:03 +07:00
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
2024-08-26 21:48:03 +07:00
{% 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 %}
#
2024-08-26 21:48:03 +07:00
# * SSL/TLS
#
2024-08-26 21:48:03 +07:00
# 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
2024-08-26 21:48:03 +07:00
#require-secure-transport = on
#
# * Character sets
#
2024-08-26 21:48:03 +07:00
# 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
#
2024-08-26 21:48:03 +07:00
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
2024-08-26 21:48:03 +07:00
# 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 }}
2024-08-26 21:48:03 +07:00
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
2024-08-26 21:48:03 +07:00
[mariadbd]
2024-08-26 21:48:03 +07:00
# 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
2024-08-26 21:48:03 +07:00
[mariadb-{{ __mariadb_version.stdout }}]