Browse Source

Support redhat with mariadb

tags/1.0
Filip Pytloun 8 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

@@ -16,7 +16,7 @@ datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
pid_file=mysqld.pid
port=3306
log_error=/var/log/mysql.log
log_error={{ service.log_file }}
log_warnings=2
#log_output=FILE
### INNODB OPTIONS
@@ -184,6 +184,6 @@ socket=/var/run/mysqld/mysqld.sock
default_character_set=utf8
[MYSQLD_SAFE]
pid_file=mysqld.pid
log_error=/var/log/mysql.log
log_error={{ service.log_file }}
basedir=/usr/
datadir=/var/lib/mysql

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

@@ -16,7 +16,7 @@ datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
pid_file=mysqld.pid
port=3306
log_error=/var/log/mysql.log
log_error={{ service.log_file }}
log_warnings=2
#log_output=FILE
### INNODB OPTIONS
@@ -97,6 +97,6 @@ socket=/var/run/mysqld/mysqld.sock
default_character_set=utf8
[MYSQLD_SAFE]
pid_file=mysqld.pid
log_error=/var/log/mysql.log
log_error={{ service.log_file }}
basedir=/usr/
datadir=/var/lib/mysql

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

@@ -16,7 +16,7 @@ datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
pid_file=mysqld.pid
port=3306
log_error=/var/log/mysql.log
log_error={{ service.log_file }}
log_warnings=2
#log_output=FILE
### INNODB OPTIONS
@@ -183,6 +183,6 @@ socket=/var/run/mysqld/mysqld.sock
default_character_set=utf8
[MYSQLD_SAFE]
pid_file=mysqld.pid
log_error=/var/log/mysql.log
log_error={{ service.log_file }}
basedir=/usr/
datadir=/var/lib/mysql

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

@@ -1,17 +1,18 @@
{%- from "galera/map.jinja" import slave with context -%}
#!/bin/bash

service mysql start
service {{ slave.service }} start

counter=40

while [ $counter -gt 0 ]
do
service mysql status
service {{ slave.service }} status
if [[ $? -eq 0 ]]; then
exit 0
fi
counter=$(( $counter - 1 ))
counter=$(( $counter - 1 ))
sleep 2
done

exit 1
exit 1

+ 8
- 4
galera/map.jinja View File

@@ -3,11 +3,13 @@
'Debian': {
'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'],
'service': 'mysql',
'log_file': '/var/log/mysql.log',
'config': '/etc/mysql/my.cnf',
},
'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',
},
}, merge=salt['pillar.get']('galera:master')) %}
@@ -16,11 +18,13 @@
'Debian': {
'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'],
'service': 'mysql',
'log_file': '/var/log/mysql.log',
'config': '/etc/mysql/my.cnf',
},
'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',
},
}, merge=salt['pillar.get']('galera:slave')) %}

+ 2
- 2
galera/master.sls View File

@@ -35,7 +35,7 @@ galera_bootstrap_temp_config:

galera_bootstrap_start_service:
service.running:
- name: mysql
- name: {{ master.service }}
- require:
- file: galera_bootstrap_temp_config

@@ -97,4 +97,4 @@ galera_service:
- enable: true
- reload: true

{%- endif %}
{%- endif %}

+ 3
- 2
galera/slave.sls View File

@@ -35,7 +35,7 @@ galera_bootstrap_temp_config:

galera_bootstrap_start_service:
service.running:
- name: mysql
- name: {{ slave.service }}
- require:
- file: galera_bootstrap_temp_config

@@ -70,6 +70,7 @@ galera_bootstrap_start_service_final:
cmd.script:
- name: slave_bootstrap
- source: salt://galera/files/slave_bootstrap.sh
- template: jinja
- require:
- file: galera_bootstrap_init_config

@@ -98,4 +99,4 @@ galera_service:
- enable: true
- reload: true

{%- endif %}
{%- endif %}

Loading…
Cancel
Save