From 68aefe8ef292999af338cc2b077a185872a0217e Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Wed, 27 May 2020 15:42:13 +0200 Subject: [PATCH] Improve doc --- README.md | 18 ++++++++---------- my.cnf | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 my.cnf diff --git a/README.md b/README.md index 639cf17..e1f7f34 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![travis build status](https://img.shields.io/travis/fauust/ansible-role-mariadb?logo=travis)](https://travis-ci.org/fauust/ansible-role-mariadb) -Install and configure MariaDB server on Debian/Ubuntu. +Install and configure MariaDB Server on Debian/Ubuntu. Optionally, this role also permits to: @@ -46,7 +46,7 @@ deploy the version packaged by the MariaDB Foundation. You will find the repositories URL here: -By default we deploy the MariaDB Server version that comes with the distribution. +By default, we deploy the MariaDB Server version that comes with the distribution. ### MariaDB service activation and restart @@ -56,7 +56,7 @@ mariadb_can_restart: true ``` **Warning:** you may consider setting `mariadb_can_restart` to `false` on -production systems to prevent ansible runs to restart the MariaDB server. +production systems to prevent ansible runs to restart the MariaDB Server. ### General configuration @@ -64,15 +64,13 @@ To populate the MariaDB Server configuration file, we use almost only raw variables. This permits more flexibility and a very simple [`templates/my.cnf.j2`](./templates/my.cnf.j2) file. -By default, some common and standard options are deployed. +By default, some common and standard options are deployed based on MariaDB +Foundation package and it should be easy to change all of them. #### Basic settings -The following variables are also needed by playbooks so we can not use raw -variables. - ```yaml -mariadb_config_file: /etc/mysql/my.cnf +mariadb_config_file: "/etc/mysql/my.cnf" mariadb_datadir: "/var/lib/mysql" mariadb_port: "3306" mariadb_bind_address: "127.0.0.1" @@ -224,10 +222,10 @@ mariadb_backup_db_name: [] Database dump is done serially and compression (`gzip`) is done at the end to avoid too long locks. -## Example Playbook +## Example playbook ```yaml -- hosts: database +- hosts: db roles: - fauust.mariadb ``` diff --git a/my.cnf b/my.cnf new file mode 100644 index 0000000..9799e2b --- /dev/null +++ b/my.cnf @@ -0,0 +1,47 @@ +# Ansible managed + +[mariadb] + +# Basic settings +user = mysql +pid-file = /run/mysqld/mysqld.pid +socket = /run/mysqld/mysqld.sock +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +lc-messages-dir = /usr/share/mysql +lc_messages = en_US +skip-external-locking +port = 3306 +bind-address = 127.0.0.1 + +# Fine tuning +max_connections = 100 +connect_timeout = 5 +wait_timeout = 600 +max_allowed_packet = 16M +thread_cache_size = 128 +sort_buffer_size = 4M +bulk_insert_buffer_size = 16M +tmp_table_size = 32M +max_heap_table_size = 32M + +# Logging +log_error = /var/log/mysql/error.log + +# Query cache +query_cache_size = 16M + +# Character sets +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! + + +[mysqldump] +quick +quote-names +max_allowed_packet = 16M