Better master and support MariaDB GTID

pull/6/head
Emilien Mantel 2015-08-11 11:26:56 +02:00
parent 16b105786b
commit 8a8966a3f8
5 changed files with 26 additions and 4 deletions

View File

@ -114,6 +114,8 @@ mysql_master_log_pos: null
# If true, reconfigure slave # If true, reconfigure slave
mysql_slave_force_setup: false mysql_slave_force_setup: false
# Only MariaDB 10.0+
mysql_gtid_domain_id: 1
# ------------------------------------- # -------------------------------------
# Database / Users # Database / Users

View File

@ -0,0 +1,12 @@
---
- name: MYSQL_VARIABLES | Get MySQL vendor
mysql_variables: variable=version_comment
register: vc
- name: SET_FACT | Server can use GTID
set_fact: mysql_gtid=true
when: >
( mysql_vendor == 'mariadb' and vc.msg[0][1] | version_compare('10.0.2', 'ge') ) or
( vc.msg[0][1] | version_compare('5.6.5', 'ge') )

View File

@ -29,6 +29,9 @@
- name: TEMPLATE Create .my.cnf for root - name: TEMPLATE Create .my.cnf for root
template: src=root/my.cnf dest=/root/.my.cnf owner=root group=root mode=0600 backup=yes template: src=root/my.cnf dest=/root/.my.cnf owner=root group=root mode=0600 backup=yes
- name: INCLUDE | Detect if server supports GTID
include: detect_gtid.yml
- name: INCLUDE | Replication Master - name: INCLUDE | Replication Master
include: replication_master.yml include: replication_master.yml
when: mysql_replication_master when: mysql_replication_master

View File

@ -35,4 +35,4 @@
when: > when: >
mysql_vendor == 'mariadb' and mysql_vendor == 'mariadb' and
slave_status.Using_Gtid == 'No' and slave_status.Using_Gtid == 'No' and
mysql_mysql_gtid mysql_gtid

View File

@ -7,9 +7,14 @@
[mysqld] [mysqld]
server_id={{ mysql_server_id }} server_id={{ mysql_server_id }}
log-bin log_bin = mysql-bin
log-bin-index = mysql-bin.index
expire_logs_days = {{ mysql_expire_logs_days }}
max_binlog_size = {{ mysql_max_binlog_size }}
# MariaDB only? {% if mysql_vendor == 'mariadb' and mysql_gtid %}
#gtid_domain_id=1 # MariaDB only
gtid_domain_id={{ mysql_gtid_domain_id }}
{% endif %}
; vim: set ft=dosini : ; vim: set ft=dosini :