[GALERA] Install and configuration OK => wsrep_ready ON

pull/14/head
Emilien Mantel 2016-09-23 11:40:35 +02:00
parent d56bd9d078
commit d0c3b67f16
7 changed files with 42 additions and 3 deletions

View File

@ -14,7 +14,7 @@ Role Variables
-------------- --------------
- `mysql_origin`: origin of the package ("default" or "upstream") - `mysql_origin`: origin of the package ("default" or "upstream")
- `mysql_vendor`: "mysql", "mariadb" or "percona" - `mysql_vendor`: "mysql", "mariadb", "mariadb\_galera" (only with MariaDB upstream 10.1) or "percona"
- `mysql_use_percona_repository`: use percona APT repository (automatic setted to true if you use "percona" as `mysql_vendor`). - `mysql_use_percona_repository`: use percona APT repository (automatic setted to true if you use "percona" as `mysql_vendor`).
### Configuration ### Configuration

View File

@ -7,6 +7,7 @@
(mysql_origin == 'default' and mysql_vendor == 'mysql') or (mysql_origin == 'default' and mysql_vendor == 'mysql') or
(mysql_origin == 'default' and mysql_vendor == 'mariadb') or (mysql_origin == 'default' and mysql_vendor == 'mariadb') or
(mysql_origin == 'upstream' and mysql_vendor == 'mariadb') or (mysql_origin == 'upstream' and mysql_vendor == 'mariadb') or
(mysql_origin == 'upstream' and mysql_vendor == 'mariadb_galera') or
(mysql_origin == 'upstream' and mysql_vendor == 'percona') (mysql_origin == 'upstream' and mysql_vendor == 'percona')
) )
@ -24,7 +25,7 @@
- name: INCLUDE | Install MariaDB from MariaDB repo - name: INCLUDE | Install MariaDB from MariaDB repo
include: 'mariadb/upstream.yml' include: 'mariadb/upstream.yml'
when: mysql_origin == 'upstream' and mysql_vendor == 'mariadb' when: mysql_origin == 'upstream' and (mysql_vendor == 'mariadb' or mysql_vendor == 'mariadb_galera')
- name: INCLUDE | Install Percona Server from Percona repo - name: INCLUDE | Install Percona Server from Percona repo
include: 'percona/upstream.yml' include: 'percona/upstream.yml'

View File

@ -16,3 +16,7 @@
- name: APT | Install MariaDB server - name: APT | Install MariaDB server
apt: pkg=mariadb-server state=present apt: pkg=mariadb-server state=present
- name: APT | Install Galera
apt: pkg=galera-3 state=present
when: mysql_vendor == 'mariadb_galera'

View File

@ -16,9 +16,16 @@
template: src=etc/mysql/conf.d/10-extra.cnf.j2 dest=/etc/mysql/conf.d/10-extra.cnf template: src=etc/mysql/conf.d/10-extra.cnf.j2 dest=/etc/mysql/conf.d/10-extra.cnf
register: extraconfig register: extraconfig
- name: TEMPLATE | Deploy Galera configuration
template: src=etc/mysql/conf.d/09-galera.cnf.j2 dest=/etc/mysql/conf.d/09-galera.cnf
register: galeraconfig
- name: SERVICE | Restart now (prevent bugs) - name: SERVICE | Restart now (prevent bugs)
service: name=mysql state=restarted service: name=mysql state=restarted
when: config.changed or extraconfig.changed when: >
config.changed or
extraconfig.changed or
(galeraconfig is defined and galeraconfig.changed)
- 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

View File

@ -0,0 +1,21 @@
#
# {{ ansible_managed }}
#
[mysqld]
# Galera config
wsrep_on=ON
# TODO: wsrep_cluster_address=gcomm://cluster01,cluster02,cluster03
wsrep_cluster_address=gcomm://127.0.0.1
# TODO: https://mariadb.com/kb/en/mariadb/galera-cluster-system-variables/#wsrep_sst_method
wsrep_sst_method=rsync
# TODO: wsrep_cluster_name="my_wsrep_cluster"
# Deps
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
query_cache_size=0

View File

@ -1 +1,3 @@
mysql_vendor: 'mariadb_galera' mysql_vendor: 'mariadb_galera'
mysql_use_percona_repository: false
mariadb_version: '10.1'

View File

@ -37,3 +37,7 @@
delegate_to: "{{ his_master }}" delegate_to: "{{ his_master }}"
when: c.changed when: c.changed
- hosts: mariadbgalera
roles:
- ../../