socket=/var/run/mysqld/mysqld.sock | socket=/var/run/mysqld/mysqld.sock | ||||
pid_file=mysqld.pid | pid_file=mysqld.pid | ||||
port=3306 | port=3306 | ||||
log_error=/var/log/mysql.log | |||||
log_error={{ service.log_file }} | |||||
log_warnings=2 | log_warnings=2 | ||||
#log_output=FILE | #log_output=FILE | ||||
### INNODB OPTIONS | ### INNODB OPTIONS | ||||
default_character_set=utf8 | default_character_set=utf8 | ||||
[MYSQLD_SAFE] | [MYSQLD_SAFE] | ||||
pid_file=mysqld.pid | pid_file=mysqld.pid | ||||
log_error=/var/log/mysql.log | |||||
log_error={{ service.log_file }} | |||||
basedir=/usr/ | basedir=/usr/ | ||||
datadir=/var/lib/mysql | datadir=/var/lib/mysql |
socket=/var/run/mysqld/mysqld.sock | socket=/var/run/mysqld/mysqld.sock | ||||
pid_file=mysqld.pid | pid_file=mysqld.pid | ||||
port=3306 | port=3306 | ||||
log_error=/var/log/mysql.log | |||||
log_error={{ service.log_file }} | |||||
log_warnings=2 | log_warnings=2 | ||||
#log_output=FILE | #log_output=FILE | ||||
### INNODB OPTIONS | ### INNODB OPTIONS | ||||
default_character_set=utf8 | default_character_set=utf8 | ||||
[MYSQLD_SAFE] | [MYSQLD_SAFE] | ||||
pid_file=mysqld.pid | pid_file=mysqld.pid | ||||
log_error=/var/log/mysql.log | |||||
log_error={{ service.log_file }} | |||||
basedir=/usr/ | basedir=/usr/ | ||||
datadir=/var/lib/mysql | datadir=/var/lib/mysql |
socket=/var/run/mysqld/mysqld.sock | socket=/var/run/mysqld/mysqld.sock | ||||
pid_file=mysqld.pid | pid_file=mysqld.pid | ||||
port=3306 | port=3306 | ||||
log_error=/var/log/mysql.log | |||||
log_error={{ service.log_file }} | |||||
log_warnings=2 | log_warnings=2 | ||||
#log_output=FILE | #log_output=FILE | ||||
### INNODB OPTIONS | ### INNODB OPTIONS | ||||
default_character_set=utf8 | default_character_set=utf8 | ||||
[MYSQLD_SAFE] | [MYSQLD_SAFE] | ||||
pid_file=mysqld.pid | pid_file=mysqld.pid | ||||
log_error=/var/log/mysql.log | |||||
log_error={{ service.log_file }} | |||||
basedir=/usr/ | basedir=/usr/ | ||||
datadir=/var/lib/mysql | datadir=/var/lib/mysql |
{%- from "galera/map.jinja" import slave with context -%} | |||||
#!/bin/bash | #!/bin/bash | ||||
service mysql start | |||||
service {{ slave.service }} start | |||||
counter=40 | counter=40 | ||||
while [ $counter -gt 0 ] | while [ $counter -gt 0 ] | ||||
do | do | ||||
service mysql status | |||||
service {{ slave.service }} status | |||||
if [[ $? -eq 0 ]]; then | if [[ $? -eq 0 ]]; then | ||||
exit 0 | exit 0 | ||||
fi | fi | ||||
counter=$(( $counter - 1 )) | |||||
counter=$(( $counter - 1 )) | |||||
sleep 2 | sleep 2 | ||||
done | done | ||||
exit 1 | |||||
exit 1 |
'Debian': { | 'Debian': { | ||||
'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'], | 'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'], | ||||
'service': 'mysql', | 'service': 'mysql', | ||||
'log_file': '/var/log/mysql.log', | |||||
'config': '/etc/mysql/my.cnf', | 'config': '/etc/mysql/my.cnf', | ||||
}, | }, | ||||
'RedHat': { | 'RedHat': { | ||||
'pkgs': ['MySQL-server', 'galera', 'MySQL-client', 'MySQL-python', 'rsync'], | |||||
'service': 'mysql', | |||||
'pkgs': ['mariadb-galera-cluster', 'mariadb', 'MySQL-python', 'rsync'], | |||||
'service': 'mysqld', | |||||
'log_file': '/var/log/mariadb/mariadb.log', | |||||
'config': '/etc/mysql/my.cnf', | 'config': '/etc/mysql/my.cnf', | ||||
}, | }, | ||||
}, merge=salt['pillar.get']('galera:master')) %} | }, merge=salt['pillar.get']('galera:master')) %} | ||||
'Debian': { | 'Debian': { | ||||
'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'], | 'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'], | ||||
'service': 'mysql', | 'service': 'mysql', | ||||
'log_file': '/var/log/mysql.log', | |||||
'config': '/etc/mysql/my.cnf', | 'config': '/etc/mysql/my.cnf', | ||||
}, | }, | ||||
'RedHat': { | 'RedHat': { | ||||
'pkgs': ['MySQL-server', 'galera', 'MySQL-client', 'MySQL-python', 'rsync'], | |||||
'service': 'mysql', | |||||
'pkgs': ['mariadb-galera-cluster', 'mariadb', 'MySQL-python', 'rsync'], | |||||
'service': 'mysqld', | |||||
'log_file': '/var/log/mariadb/mariadb.log', | |||||
'config': '/etc/mysql/my.cnf', | 'config': '/etc/mysql/my.cnf', | ||||
}, | }, | ||||
}, merge=salt['pillar.get']('galera:slave')) %} | }, merge=salt['pillar.get']('galera:slave')) %} |
galera_bootstrap_start_service: | galera_bootstrap_start_service: | ||||
service.running: | service.running: | ||||
- name: mysql | |||||
- name: {{ master.service }} | |||||
- require: | - require: | ||||
- file: galera_bootstrap_temp_config | - file: galera_bootstrap_temp_config | ||||
- enable: true | - enable: true | ||||
- reload: true | - reload: true | ||||
{%- endif %} | |||||
{%- endif %} |
galera_bootstrap_start_service: | galera_bootstrap_start_service: | ||||
service.running: | service.running: | ||||
- name: mysql | |||||
- name: {{ slave.service }} | |||||
- require: | - require: | ||||
- file: galera_bootstrap_temp_config | - file: galera_bootstrap_temp_config | ||||
cmd.script: | cmd.script: | ||||
- name: slave_bootstrap | - name: slave_bootstrap | ||||
- source: salt://galera/files/slave_bootstrap.sh | - source: salt://galera/files/slave_bootstrap.sh | ||||
- template: jinja | |||||
- require: | - require: | ||||
- file: galera_bootstrap_init_config | - file: galera_bootstrap_init_config | ||||
- enable: true | - enable: true | ||||
- reload: true | - reload: true | ||||
{%- endif %} | |||||
{%- endif %} |