Support redhat with mariadb
diff --git a/galera/files/my.cnf b/galera/files/my.cnf
index 91628d3..e5e2ab9 100644
--- a/galera/files/my.cnf
+++ b/galera/files/my.cnf
@@ -16,7 +16,7 @@
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 @@
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
diff --git a/galera/files/my.cnf.bootstrap b/galera/files/my.cnf.bootstrap
index b5cbd93..223d910 100644
--- a/galera/files/my.cnf.bootstrap
+++ b/galera/files/my.cnf.bootstrap
@@ -16,7 +16,7 @@
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 @@
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
diff --git a/galera/files/my.cnf.init b/galera/files/my.cnf.init
index 97ece92..1170170 100644
--- a/galera/files/my.cnf.init
+++ b/galera/files/my.cnf.init
@@ -16,7 +16,7 @@
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 @@
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
diff --git a/galera/files/slave_bootstrap.sh b/galera/files/slave_bootstrap.sh
index f13d4f0..8e163dc 100644
--- a/galera/files/slave_bootstrap.sh
+++ b/galera/files/slave_bootstrap.sh
@@ -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
\ No newline at end of file
+exit 1
diff --git a/galera/map.jinja b/galera/map.jinja
index e213665..da37f1e 100644
--- a/galera/map.jinja
+++ b/galera/map.jinja
@@ -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')) %}
diff --git a/galera/master.sls b/galera/master.sls
index a732841..cfec7c7 100644
--- a/galera/master.sls
+++ b/galera/master.sls
@@ -35,7 +35,7 @@
galera_bootstrap_start_service:
service.running:
- - name: mysql
+ - name: {{ master.service }}
- require:
- file: galera_bootstrap_temp_config
@@ -97,4 +97,4 @@
- enable: true
- reload: true
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/galera/slave.sls b/galera/slave.sls
index 1381d82..fa56091 100644
--- a/galera/slave.sls
+++ b/galera/slave.sls
@@ -35,7 +35,7 @@
galera_bootstrap_start_service:
service.running:
- - name: mysql
+ - name: {{ slave.service }}
- require:
- file: galera_bootstrap_temp_config
@@ -70,6 +70,7 @@
cmd.script:
- name: slave_bootstrap
- source: salt://galera/files/slave_bootstrap.sh
+ - template: jinja
- require:
- file: galera_bootstrap_init_config
@@ -98,4 +99,4 @@
- enable: true
- reload: true
-{%- endif %}
\ No newline at end of file
+{%- endif %}