Merge pull request #18 from jaspernbrouwer/debian-stretch-2
Improvements for MariaDB on Debian Stretchpull/20/head
commit
7617530349
|
@ -13,6 +13,9 @@ mysql_upstream_apt_src: false
|
||||||
# Configuration
|
# Configuration
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
||||||
|
# MySQL configuration template
|
||||||
|
mysql_config_template: 'etc/mysql/my.cnf.j2'
|
||||||
|
|
||||||
# MySQL connection settings.
|
# MySQL connection settings.
|
||||||
mysql_port: "3306"
|
mysql_port: "3306"
|
||||||
mysql_bind_address: '127.0.0.1'
|
mysql_bind_address: '127.0.0.1'
|
||||||
|
@ -40,12 +43,12 @@ mysql_query_cache_size: '16M'
|
||||||
mysql_wait_timeout: 28800
|
mysql_wait_timeout: 28800
|
||||||
|
|
||||||
# Try number of CPU's * 2 for thread_concurrency.
|
# Try number of CPU's * 2 for thread_concurrency.
|
||||||
mysql_thread_concurrency: 2
|
mysql_thread_concurrency: "{{ ansible_processor_cores * 2 }}"
|
||||||
|
|
||||||
# InnoDB settings.
|
# InnoDB settings.
|
||||||
mysql_innodb_file_per_table: '1'
|
mysql_innodb_file_per_table: '1'
|
||||||
mysql_innodb_buffer_pool_size: "{{ (ansible_memtotal_mb * 0.2) | round | int }}M"
|
mysql_innodb_buffer_pool_size: "{{ (ansible_memtotal_mb * 0.2) | round | int }}M"
|
||||||
mysql_innodb_log_file_size: '64M'
|
mysql_innodb_log_file_size: "{% if ansible_distribution_release == 'jessie' and mysql_vendor == 'mysql' %}5M{% else %}64M{% endif %}" # If this setting changes on a running system, you will break it! http://dev.mysql.com/doc/refman/5.6/en/innodb-data-log-reconfiguration.html
|
||||||
mysql_innodb_log_buffer_size: '8M'
|
mysql_innodb_log_buffer_size: '8M'
|
||||||
mysql_innodb_flush_log_at_trx_commit: '1'
|
mysql_innodb_flush_log_at_trx_commit: '1'
|
||||||
mysql_innodb_lock_wait_timeout: 50
|
mysql_innodb_lock_wait_timeout: 50
|
||||||
|
@ -124,8 +127,11 @@ mysql_users: []
|
||||||
# MariaDB
|
# MariaDB
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
mysql_mariadb_version: '10.1'
|
mysql_mariadb_version: '10.1'
|
||||||
# See: http://mariadb.org/mariadb/repositories/
|
mysql_mariadb_mirror_domain: "ftp.igh.cnrs.fr"
|
||||||
mysql_mariadb_repository: "http://ftp.igh.cnrs.fr/pub/mariadb/repo/{{ mysql_mariadb_version }}/debian"
|
# See: https://downloads.mariadb.org/mariadb/repositories
|
||||||
|
mysql_mariadb_repository: "http://{{ mysql_mariadb_mirror_domain }}/pub/mariadb/repo/{{ mysql_mariadb_version }}/debian"
|
||||||
|
mysql_mariadb_key_server: "keyserver.ubuntu.com"
|
||||||
|
mysql_mariadb_key_ids: ['0xcbcb082a1bb943db', '0xf1656f24c74cd1d8']
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Percona
|
# Percona
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: APT | Install MariaDB key
|
- name: APT_KEY | Install MariaDB key
|
||||||
apt_key: keyserver="keyserver.ubuntu.com" id={{ item }} state=present
|
apt_key: keyserver="{{ mysql_mariadb_key_server }}" id={{ item }} state=present
|
||||||
with_items: ['0xcbcb082a1bb943db', '0xf1656f24c74cd1d8']
|
with_items: "{{ mysql_mariadb_key_ids }}"
|
||||||
|
|
||||||
- name: APT | Add MariaDB repository
|
- name: TEMPLATE | Deploy APT pinning (prevent upgrades from Debian)
|
||||||
|
template: src=etc/apt/preferences.d/95-mariadb.j2 dest=/etc/apt/preferences.d/95-mariadb
|
||||||
|
|
||||||
|
- name: APT_REPOSITORY | Add MariaDB repository
|
||||||
apt_repository: repo='deb {{ mysql_mariadb_repository }} {{ ansible_distribution_release }} main' state=present
|
apt_repository: repo='deb {{ mysql_mariadb_repository }} {{ ansible_distribution_release }} main' state=present
|
||||||
|
|
||||||
- name: APT | Add MariaDB (src) repository
|
- name: APT_REPOSITORY | Add MariaDB (src) repository
|
||||||
apt_repository: repo='deb-src {{ mysql_mariadb_repository }} {{ ansible_distribution_release }} main' state=present
|
apt_repository: repo='deb-src {{ mysql_mariadb_repository }} {{ ansible_distribution_release }} main' state=present
|
||||||
when: mysql_upstream_apt_src
|
when: mysql_upstream_apt_src
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
include: install/main.yml
|
include: install/main.yml
|
||||||
|
|
||||||
- name: TEMPLATE | Deploy configuration
|
- name: TEMPLATE | Deploy configuration
|
||||||
template: src=etc/mysql/my.cnf.j2 dest=/etc/mysql/my.cnf
|
template: "src={{ mysql_config_template }} dest=/etc/mysql/my.cnf"
|
||||||
register: config
|
register: config
|
||||||
|
|
||||||
- name: TEMPLATE | Deploy extra configuration
|
- name: TEMPLATE | Deploy extra configuration
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
Explanation: Prevent Debian upgrades on mariadb packages
|
||||||
|
Package: *
|
||||||
|
Pin: origin {{ mysql_mariadb_mirror_domain }}
|
||||||
|
Pin-Priority: 1000
|
|
@ -12,28 +12,28 @@ bind-address = {{ mysql_bind_address }}
|
||||||
datadir = {{ mysql_datadir }}
|
datadir = {{ mysql_datadir }}
|
||||||
socket = {{ mysql_socket }}
|
socket = {{ mysql_socket }}
|
||||||
|
|
||||||
# TODO: FIX later
|
{# TODO: FIX later #}
|
||||||
# Logging configuration.
|
# Logging configuration.
|
||||||
#{% if mysql_log_error == 'syslog' or mysql_log == 'syslog' %}
|
{% if mysql_log_error == 'syslog' or mysql_log == 'syslog' %}
|
||||||
#syslog
|
syslog
|
||||||
#syslog-tag = {{ mysql_syslog_tag }}
|
syslog-tag = {{ mysql_syslog_tag }}
|
||||||
#{% else %}
|
{% else %}
|
||||||
#{% if mysql_log %}
|
{% if mysql_log %}
|
||||||
#log = {{ mysql_log }}
|
log = {{ mysql_log }}
|
||||||
#{% endif %}
|
{% endif %}
|
||||||
#log-error = {{ mysql_log_error }}
|
log-error = {{ mysql_log_error }}
|
||||||
#{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if mysql_slow_query_log_enabled %}
|
{% if mysql_slow_query_log_enabled %}
|
||||||
# Slow query log configuration.
|
# Slow query log configuration.
|
||||||
|
{% if mysql_vendor not in ['mariadb', 'mariadbgalera'] or mysql_mariadb_version | version_compare('10.0', '<') %}
|
||||||
log_slow_queries = 1
|
log_slow_queries = 1
|
||||||
|
{% endif %}
|
||||||
slow_query_log = 1
|
slow_query_log = 1
|
||||||
slow_query_log_file = {{ mysql_slow_query_log_file }}
|
slow_query_log_file = {{ mysql_slow_query_log_file }}
|
||||||
long_query_time = {{ mysql_slow_query_time }}
|
long_query_time = {{ mysql_slow_query_time }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||||
symbolic-links = 0
|
symbolic-links = 0
|
||||||
|
|
||||||
|
@ -63,11 +63,13 @@ thread_concurrency = {{ mysql_thread_concurrency }}
|
||||||
# InnoDB settings.
|
# InnoDB settings.
|
||||||
innodb_file_per_table = {{ mysql_innodb_file_per_table }}
|
innodb_file_per_table = {{ mysql_innodb_file_per_table }}
|
||||||
innodb_buffer_pool_size = {{ mysql_innodb_buffer_pool_size }}
|
innodb_buffer_pool_size = {{ mysql_innodb_buffer_pool_size }}
|
||||||
# It craches after install (mysql 5.5)... TODO FIX -> http://dev.mysql.com/doc/refman/5.6/en/innodb-data-log-reconfiguration.html
|
innodb_log_buffer_size = {{ mysql_innodb_log_buffer_size }}
|
||||||
#innodb_log_file_size = {{ mysql_innodb_log_file_size }}
|
|
||||||
#innodb_log_buffer_size = {{ mysql_innodb_log_buffer_size }}
|
|
||||||
innodb_flush_log_at_trx_commit = {{ mysql_innodb_flush_log_at_trx_commit }}
|
innodb_flush_log_at_trx_commit = {{ mysql_innodb_flush_log_at_trx_commit }}
|
||||||
innodb_lock_wait_timeout = {{ mysql_innodb_lock_wait_timeout }}
|
innodb_lock_wait_timeout = {{ mysql_innodb_lock_wait_timeout }}
|
||||||
|
{# If this setting changes on a running system, you will break it! #}
|
||||||
|
{# See how tho change it here: http://dev.mysql.com/doc/refman/5.6/en/innodb-data-log-reconfiguration.html #}
|
||||||
|
{# TODO FIX -> Maybe detect a change and fail, just to be safe? #}
|
||||||
|
innodb_log_file_size = {{ mysql_innodb_log_file_size }}
|
||||||
|
|
||||||
[mysqldump]
|
[mysqldump]
|
||||||
quick
|
quick
|
||||||
|
|
Loading…
Reference in New Issue