diff --git a/roles/services/files/z90-vn.cnf b/roles/services/files/mariaconfigfiles/z90-vn.cnf similarity index 79% rename from roles/services/files/z90-vn.cnf rename to roles/services/files/mariaconfigfiles/z90-vn.cnf index 0f6a716..1911135 100644 --- a/roles/services/files/z90-vn.cnf +++ b/roles/services/files/mariaconfigfiles/z90-vn.cnf @@ -6,7 +6,7 @@ lc_time_names = es_ES character-set-server = utf8 collation-server = utf8_unicode_ci explicit_defaults_for_timestamp = ON -datadir = /var/lib/mysql +datadir = /mnt/mysqldata/mysql tmpdir = /mnt/mysqltmp log_bin_trust_function_creators = 1 sql_mode = NO_ENGINE_SUBSTITUTION @@ -42,30 +42,11 @@ max_connect_errors = 50 #++++++++++++++++++++++++++++++++++++++++ Binary log -log-bin = /mnt/mysqlbin/binlog/bin.log max_binlog_size = 1GB binlog_cache_size = 16M binlog_stmt_cache_size = 16M binlog_row_image = noblob binlog_format = row -relay_log = /mnt/mysqlbin/binlog/relay.log - -binlog-ignore-db = tmp -binlog-ignore-db = PERCONA_SCHEMA - -#++++++++++++++++++++++++++++++++++++++++ Replication - -event-scheduler = ON -slave_exec_mode = STRICT - -replicate-ignore-db = tmp -replicate-ignore-table = util.eventLog -replicate-ignore-table = cache.cache_calc -replicate-ignore-table = cache.available -replicate-ignore-table = cache.availableNoRaids -replicate-ignore-table = cache.cache_valid -replicate-ignore-table = cache.stock -replicate-ignore-table = cache.visible #++++++++++++++++++++++++++++++++++++++++ InnoDB @@ -80,7 +61,6 @@ innodb_checksum_algorithm = crc32 innodb_adaptive_hash_index = 0 innodb_flush_method = O_DIRECT innodb_log_buffer_size = 32M -innodb_log_file_size = 8G innodb_purge_threads = 4 innodb_buffer_pool_dump_at_shutdown = ON innodb_buffer_pool_load_at_startup = ON @@ -88,7 +68,6 @@ innodb_buffer_pool_load_at_startup = ON #++++++++++++++++++++++++++++++++++++++++ Logging log_error = /var/log/mysql/error.log -log_warnings = 1 log_output = TABLE general_log = OFF slow_query_log = ON diff --git a/roles/services/files/mariaconfigfiles/z92-testing.cnf b/roles/services/files/mariaconfigfiles/z92-testing.cnf new file mode 100644 index 0000000..e37ef52 --- /dev/null +++ b/roles/services/files/mariaconfigfiles/z92-testing.cnf @@ -0,0 +1,14 @@ +[mysqld] + +port = 3307 +bind-address = 0.0.0.0 +innodb_buffer_pool_size = 18G +event-scheduler = OFF +innodb_log_file_size = 5G +log_warnings = 2 + +#++++++++++++++++++++++++++++++++++++++++ Binary log + +log-bin = bin.log +expire_logs_days = 1 +relay_log = mysqld-relay-bin diff --git a/roles/services/files/mariaconfigfiles/z95-production.cnf b/roles/services/files/mariaconfigfiles/z95-production.cnf new file mode 100644 index 0000000..0861a85 --- /dev/null +++ b/roles/services/files/mariaconfigfiles/z95-production.cnf @@ -0,0 +1,29 @@ +[mysqld] + +port = 3306 +innodb_log_file_size = 8G +log_warnings = 1 + +#++++++++++++++++++++++++++++++++++++++++ Binary log + +log-bin = /mnt/mysqlbin/binlog/bin.log +max_connections = 1000 +expire_logs_days = 7 +innodb_buffer_pool_size = 64G +relay_log = /mnt/mysqlbin/binlog/relay.log +binlog-ignore-db = tmp +binlog-ignore-db = PERCONA_SCHEMA + +#++++++++++++++++++++++++++++++++++++++++ Replication + +event-scheduler = ON +slave_exec_mode = STRICT + +replicate-ignore-db = tmp +replicate-ignore-table = util.eventLog +replicate-ignore-table = cache.cache_calc +replicate-ignore-table = cache.available +replicate-ignore-table = cache.availableNoRaids +replicate-ignore-table = cache.cache_valid +replicate-ignore-table = cache.stock +replicate-ignore-table = cache.visible diff --git a/roles/services/files/z95-production.cnf b/roles/services/files/z95-production.cnf deleted file mode 100644 index 17f9732..0000000 --- a/roles/services/files/z95-production.cnf +++ /dev/null @@ -1,6 +0,0 @@ -[mysqld] - -port = 3306 -max_connections = 1000 -expire_logs_days = 7 -innodb_buffer_pool_size = 64G diff --git a/roles/services/tasks/mariadb.yml b/roles/services/tasks/mariadb.yml index f9ec533..8866ad9 100644 --- a/roles/services/tasks/mariadb.yml +++ b/roles/services/tasks/mariadb.yml @@ -88,22 +88,54 @@ group: mysql mode: u=rw,g=,o= -- name: Set MariaDB custom configuration - copy: - src: "{{ item }}" +- when: production is true + block: + - name: Set MariaDB custom configuration Production + copy: + src: "{{ item }}" + dest: /etc/mysql/mariadb.conf.d/ + owner: root + group: root + mode: u=rw,g=r,o=r + with_items: + - "files/mariaconfigfiles/z90-vn.cnf" + - "files/mariaconfigfiles/z95-production" + notify: restart-mariadb + + - name: Reminder to check mount points + debug: + msg: | + Remember to check the following mount points: + - /var/lib/mysql + - /mnt/mysqlbin + - /mnt/local-backup + Make sure they are correctly configured and accessible. + +- when: testdb is true + block: + - name: Set MariaDB custom configuration Test + copy: + src: "{{ item }}" + dest: /etc/mysql/mariadb.conf.d/ + owner: root + group: root + mode: u=rw,g=r,o=r + with_items: + - "files/mariaconfigfiles/z90-vn.cnf" + - "files/mariaconfigfiles/z92-testing.cnf" + notify: restart-mariadb + + - name: Reminder to check mount points + debug: + msg: | + Remember to check the following mount points: + - /mnt/mysqltmp + Make sure they are correctly configured and accessible. + +- name: Set MariaDB local configuration file + template: + src: templates/z99-local.cnf dest: /etc/mysql/mariadb.conf.d/ owner: root group: root - mode: u=rw,g=r,o=r - with_fileglob: - - "files/z9*.cnf" - notify: restart-mariadb - -- name: Reminder to check mount points - debug: - msg: | - Remember to check the following mount points: - - /var/lib/mysql - - /mnt/mysqlbin - - /mnt/local-backup - Make sure they are correctly configured and accessible. + mode: u=rw,g=r,o=r \ No newline at end of file diff --git a/roles/services/files/z99-local.cnf b/roles/services/templates/z99-local.cnf similarity index 70% rename from roles/services/files/z99-local.cnf rename to roles/services/templates/z99-local.cnf index 58249ee..a434496 100644 --- a/roles/services/files/z99-local.cnf +++ b/roles/services/templates/z99-local.cnf @@ -1,6 +1,6 @@ [mysqld] -server-id = 1 +server-id = {{ serverid }} #bind-address = 127.0.0.1 #event-scheduler = OFF #skip-log-bin