Browse Source

Support redhat with mariadb

tags/1.0
Filip Pytloun 9 years ago
parent
commit
e40d54c89c
7 changed files with 24 additions and 18 deletions
  1. +2
    -2
      galera/files/my.cnf
  2. +2
    -2
      galera/files/my.cnf.bootstrap
  3. +2
    -2
      galera/files/my.cnf.init
  4. +5
    -4
      galera/files/slave_bootstrap.sh
  5. +8
    -4
      galera/map.jinja
  6. +2
    -2
      galera/master.sls
  7. +3
    -2
      galera/slave.sls

+ 2
- 2
galera/files/my.cnf View File

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

+ 2
- 2
galera/files/my.cnf.bootstrap View File

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

+ 2
- 2
galera/files/my.cnf.init View File

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

+ 5
- 4
galera/files/slave_bootstrap.sh View File

{%- 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

+ 8
- 4
galera/map.jinja View File

'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')) %}

+ 2
- 2
galera/master.sls View File



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 %}

+ 3
- 2
galera/slave.sls View File



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 %}

Loading…
Cancel
Save