Compare commits

..

49 Commits

Author SHA1 Message Date
03ce27c7f2 Fix schedule backup script 2020-11-19 10:16:05 +01:00
d0284ccbe4 Adding variables to create databases 2020-07-02 19:07:19 +02:00
38de7274ba Passage en 2.7.1 2020-07-02 17:02:17 +02:00
44629b4587 extract backup with mariabackup 2019-06-07 14:47:57 +02:00
b1bcd05792 afficher les erreurs en cas d'erreur de sauvegarde de la base de donnée 2019-06-06 14:38:48 +02:00
efc3f5848c mariadbBackup.cnf > debian.cnf 2019-05-20 10:25:25 +02:00
d19bfdebf9 fait fonctionner la sauvegarde mariadb 2019-04-18 17:00:07 +02:00
a199b9182d sauvegarde plutot dans /home/backup 2019-04-18 14:58:05 +02:00
d87c9ee307 ajout des extras dans le paquet 2019-04-18 14:52:17 +02:00
0327098015 Correction boucle de définitions des droits utilisateurs 2019-03-13 15:19:02 +01:00
4ee18114f4 erreur template 2019-03-04 12:07:36 +01:00
796b71a992 simplication déclaration des noeuds + ajustement règle de firewall + démarrer mariadb en postservice 2019-03-04 09:54:28 +01:00
921e6b01a1 coorection script création user maria 2019-03-01 15:35:42 +01:00
94fc8c2411 multi 2019-02-19 17:21:46 +01:00
7800e9e20a corrections 2019-02-19 16:51:14 +01:00
5817d9aee4 simplification + nom de domaine plutot que IP 2019-02-19 16:38:02 +01:00
be45f4e3fa ajout d'un warning sur les netmask des ip des connexions autorisées à la BDD 2019-02-19 10:02:40 +01:00
f65fc17332 script création maria-sys pour les sauvegardes 2019-02-15 17:26:49 +01:00
d84efbfaa4 retour au sauvegarde Bareos pour incompatibilité Xtrabackup, personnalisation des sauvegardes pour MaraiDB 2019-02-15 11:04:05 +01:00
4dd7e78f7c MAJ du README pour la 2.7.0 2019-02-14 10:04:09 +01:00
7a99473352 Merge branch 'master' of https://forge.cadoles.com/Cadoles/eole-mariadb 2018-09-03 14:01:45 +02:00
29aca663dd Ajout de la possibilité de spécifier "innodb_lock_wait_timeout" 2018-09-03 12:05:07 +02:00
f832feeae3 ajout d'une condition pour pouvoir activer ou non la sauveagrde de mariadb 2018-06-22 16:44:19 +02:00
196a4b41f2 Prise en charge du dump des bases mariadb par schedule et bareos + copier des dump sur le partage nfs 2018-06-22 16:33:59 +02:00
cb7954fb66 Make cache query really disabled 2018-06-21 18:32:58 +02:00
24552b6ccc Adding tunning options for InnoDBLogBufferSize and InnoDBLogFileSize 2018-06-21 15:57:17 +02:00
e80180bd04 Fixing double definition of dbWaitTimeout 2018-06-21 15:27:37 +02:00
de695a0aff Adding tunning options for wait_timeout and interactive_timeout 2018-06-21 13:32:37 +02:00
afa791cd21 Fixing typo in template 2018-06-21 11:04:14 +02:00
ff2d131d63 Adding tunning variable dbMaxAllowedPacket 2018-06-21 10:47:27 +02:00
8f5aaff1de Manage multiple clients 2018-05-28 16:13:45 +02:00
b385b1e091 Fixing Bad variable name 2018-05-22 16:39:20 +02:00
7b3f1905d9 Removing problematic condition 2018-05-17 10:15:50 +02:00
a6ebd2748f Cleaning dico 2018-05-17 10:14:01 +02:00
6780b527d8 Fixing family name 2018-05-17 10:10:47 +02:00
93fa1bde8f Updating documentation 2018-05-11 08:49:14 +02:00
3674f62d19 Fixing variable name in template 2018-05-09 18:32:26 +02:00
b0f9914eac Fixing init script 2018-05-09 17:07:19 +02:00
3102fb5fdb Stoping service before bootstrap 2018-05-09 17:01:22 +02:00
35e941bf96 Fixing bad command name 2018-05-09 15:54:38 +02:00
c11f50f009 No need to start service here 2018-05-09 15:41:04 +02:00
8369cf27da Don't run script if db is disabled 2018-05-09 14:25:25 +02:00
d04a86aedd We need to disable Tunning family 2018-05-09 14:13:18 +02:00
f7b1bbae68 Updating preservice script 2018-05-09 13:32:42 +02:00
83c797c92c Adding missing template 2018-05-09 12:27:24 +02:00
a65da51a8d Adding basic mariadb configuration 2018-05-09 12:19:44 +02:00
414154a832 Managing "Node" mode 2018-04-12 17:38:56 +02:00
e87d3ccf69 Using the correct Variable name 2018-04-12 17:16:59 +02:00
160c18fa88 Fixing syntax error 2018-04-12 17:14:05 +02:00
21 changed files with 474 additions and 290 deletions

View File

@ -4,8 +4,8 @@
SOURCE=eole-mariadb
VERSION=0.0.1
EOLE_VERSION=2.6
EOLE_RELEASE=2.6.2
EOLE_VERSION=2.7
EOLE_RELEASE=2.7.1
PKGAPPS=non
#FLASK_MODULE=<APPLICATION>

129
README.md
View File

@ -1,12 +1,139 @@
# eole-mariadb
Paquet porté pour la 2.7.1. Les tests n'ont été réalisé que sur un Eolebase.
La version utilisé est mariadb 10.3
Ajout de ce paquet sur une 2.7.1 :
## Add the Cadoles repository on all the nodes and the Leader
GenConfig [Mode Expert] -> Dépôts Tiers
* Libellé du dépôt : Cadoles dev
* Déclaration du dépôt : deb [ arch=all ] https://vulcain.cadoles.com 2.7.1-dev main
* Méthode de récupération de la clé publique du dépôt : URL de la clé
* URL de la clé : https://vulcain.cadoles.com/cadoles.gpg
## Add the MariaDB repository on all the nodes and the Leader
GenConfig (Mode Expert) -> Dépôt tiers :
* Libellé du dépôt : MariaDB
* Déclaration du dépôt : deb [ arch=amd64 ] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.3/ubuntu bionic main
* Méthode de récupération de la clé publique du dépôt : serveur de clés
* URL du serveur de clés : hkp://keyserver.ubuntu.com:80
* Empreinte de la clé : 0xF1656F24C74CD1D8
#######################################################################
Paquet porté pour la 2.7.0. Les tests n'ont été réalisé que sur un Eolebase.
La version utilisé est mariadb 10.3
Ajout de ce paquet sur une 2.7.0 :
## Add the Cadoles repository on all the nodes and the Leader
GenConfig [Mode Expert] -> Dépôts Tiers
* Libellé du dépôt : Cadoles dev
* Déclaration du dépôt : deb [ arch=all ] https://vulcain.cadoles.com 2.7.0-dev main
* Méthode de récupération de la clé publique du dépôt : URL de la clé
* URL de la clé : https://vulcain.cadoles.com/cadoles.gpg
## Add the MariaDB repository on all the nodes and the Leader
GenConfig (Mode Expert) -> Dépôt tiers :
* Libellé du dépôt : MariaDB
* Déclaration du dépôt : deb [ arch=amd64 ] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.3/ubuntu bionic main
* Méthode de récupération de la clé publique du dépôt : serveur de clés
* URL du serveur de clés : hkp://keyserver.ubuntu.com:80
* Empreinte de la clé : 0xF1656F24C74CD1D8
#######################################################################
Début des travaux pour l'utilisation de mariadb
dans Eole avec des fonctionalitées avancées du type
mise en clustter
# How-to for Eole 2.6.2 (using this repo dico and templates)
### FIXME
Start with 3 fresh eolebase 2.6.2 instancied.
One for the Clustter Leader, another for the cluster Node another for the Arbitrator, the arbitrator can be replaced by another node.
The order is very important, Never configure a Node before the Leader ! The Leader must be the first one.
## Add the Cadoles repository on all the nodes and the Leader
GenConfig [Mode Expert] -> Dépôts Tiers
* Libellé du dépôt : Cadoles dev
* Déclaration du dépôt : deb [ arch=all ] https://vulcain.cadoles.com 2.6.2-dev main
* Méthode de récupération de la clé publique du dépôt : URL de la clé
* URL de la clé : https://vulcain.cadoles.com/cadoles.gpg
## Add the MariaDB repository on all the nodes and the Leader
GenConfig (Mode Expert) -> Dépôt tiers :
* Libellé du dépôt : MariaDB
* Déclaration du dépôt : deb [arch=amd64] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.2/ubuntu xenial main
* Méthode de récupération de la clé publique du dépôt : serveur de clés
* URL du serveur de clés : hkp://keyserver.ubuntu.com:80
* Empreinte de la clé : 0xF1656F24C74CD1D8
## Configure the Leader :
GenConfig (Mode Normal) -> Services :
* Activer le serveur de base de données MariaDB : oui
GenConfig (Mode Normal) -> Database :
* Activer la mise en grappe MariaDB Galera ? : oui
GenConfig (Mode Normal) -> Database cluster :
* Rôle dans la grappe : Leader
* Interface réseau dédiée à la grappe BDD : eth0
* Nom du noeud local : <THE NAME YOU WANT>
* Membre de la grappe BDD :
* Membre de la grappe BDD : <NAME OF THE LEADER>
* Adresse IP : <IP OF THE LEADER>
* Membre de la grappe BDD : <NAME OF THE ARBITRATOR OR NODE>
* Adresse IP : <IP OF THE NODE OR ARBITRATOR>
* *Nom de la grappe : <NAME OF THE CLUSTER>
## Reconfigure Leader !
Run reconfigure command !
## Configure the Nodes !
GenConfig (Mode Normal) -> Services :
* Activer le serveur de base de données MariaDB : oui
GenConfig (Mode Normal) -> Database :
* Activer la mise en grappe MariaDB Galera ? : oui
GenConfig (Mode Normal) -> Database cluster :
* Rôle dans la grappe : Node
* Interface réseau dédiée à la grappe BDD : eth0
* Nom du noeud local : <THE NAME YOU WANT>
* Membre de la grappe BDD :
* Membre de la grappe BDD : <NAME OF THE LEADER>
* Adresse IP : <IP OF THE LEADER>
* Membre de la grappe BDD : <NAME OF THE ARBITRATOR OR NODE>
* Adresse IP : <IP OF THE NODE OR ARBITRATOR>
* *Nom de la grappe : <NAME OF THE CLUSTER>
## Reconfigure the Nodes !
Run reconfigure command on each node one by one.
## Configure the Arbitrator if needed !
If you have only 2 nodes you need to setup an arbitrator, for this follow the tutorial in the eole-galera-arbitrator project page https://forge.cadoles.com/Cadoles/eole-galera-arbitrator
# How-to for Eole 2.6.2 (From scratch)

1
debian/compat vendored
View File

@ -1 +0,0 @@
9

18
debian/control vendored
View File

@ -1,18 +0,0 @@
Source: eole-mariadb
Section: web
Priority: optional
Maintainer: Cadoles <eole@ac-dijon.fr>
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.3
Homepage: https://forge.cadoles.com/Cadoles/eole-mariadb
Vcs-Git: https://forge.cadoles.com/Cadoles/eole-mariadb.git
Vcs-Browser: https://forge.cadoles.com/Cadoles/eole-mariadb
Package: eole-mariadb
Architecture: all
Depends: ${misc:Depends}, mariadb-server
Conflicts: eole-mysql
Provides: eole-mysql
Description: Dictionnaires et templates pour la configuration d'un serveur MariaDB, testée uniquement avec eolebase
.
Pour toute information complémentaire, veuillez vous rendre sur la forge Cadoles.

44
debian/copyright vendored
View File

@ -1,44 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: {PROJECT}
Source: {URL}
Files: *
Copyright: YEAR {UPSTREAM} {AUTHOR} <{MAIL}>
License: {UPSTREAM LICENSE}
Files: debian/*
Copyright: 2012 Équipe EOLE <eole@ac-dijon.fr>
License: CeCILL-2
License: {UPSTREAM LICENSE}
{TEXT OF THE LICENSE}
License: CeCILL-2
This software is governed by the CeCILL-2 license under French law and
abiding by the rules of distribution of free software. You can use,
modify and or redistribute the software under the terms of the CeCILL-2
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info";.
.
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-2 license and that you accept its terms.
.
On Eole systems, the complete text of the CeCILL-2 License can be found
in '/usr/share/common-licenses/CeCILL-2-en'.

3
debian/gbp.conf vendored
View File

@ -1,3 +0,0 @@
# Set per distribution debian tag
[DEFAULT]
debian-tag = debian/eole/%(version)s

8
debian/rules vendored
View File

@ -1,8 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@

Binary file not shown.

View File

@ -1 +0,0 @@
3.0 (native)

View File

@ -1,35 +1,39 @@
<creole>
<files>
<file filelist='dbMariaDB' name='/etc/mysql/conf.d/mariadb.cnf' rm='True' mkdir='True'/>
<file filelist='dbCluster' name='/etc/mysql/conf.d/galera.cnf' rm='True' mkdir='True'/>
<file filelist='dbTunning' name='/etc/mysql/conf.d/tunning.cnf' rm='True' mkdir='True'/>
<service servicelist='bdd'>mariadb</service>
<service_access service='mariadb'>
<port service_accesslist='mariadb' protocol='tcp'>3306</port>
<tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
<port protocol='tcp'>3306</port>
<tcpwrapper>mariadb</tcpwrapper>
</service_access>
<service_access service='galera'>
<port service_accesslist='dbCluster' protocol='tcp'>4444</port>
<port service_accesslist='dbCluster' protocol='tcp'>4567</port>
<port service_accesslist='dbCluster' protocol='tcp'>4568</port>
<port service_accesslist='dbCluster' protocol='udp'>4567</port>
<tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
</service_access>
<service_restriction service='mariadb'>
<ip interface='ifMariaDBLimit' interface_type="SymLinkOption" netmask='maskMariaDBLimit' netmask_type='SymLinkOption' ip_type='SymLinkOption'>ipMariaDBLimit</ip>
</service_restriction>
<service_access service='galera'>
<port service_accesslist='dbCluster' protocol='tcp'>3306</port>
<port service_accesslist='dbCluster' protocol='tcp'>4444</port>
<port service_accesslist='dbCluster' protocol='tcp'>4567</port>
<port service_accesslist='dbCluster' protocol='tcp'>4568</port>
<port service_accesslist='dbCluster' protocol='udp'>4567</port>
</service_access>
<service_restriction service='galera'>
<ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMemberIP</ip>
<ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMember</ip>
</service_restriction>
</files>
<variables>
<family name="Services">
<variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'>
<value>oui</value>
</variable>
<variable name="dbEnableBackup" type='oui/non' description='Activer la sauvegarde sur le serveur de base de données MariaDB'>
<value>non</value>
</variable>
</family>
<family name="DataBase">
<family name="MariaDB" icon='mysql-alt'>
<variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?">
<value>non</value>
</variable>
@ -45,17 +49,29 @@
<value>Default</value>
</variable>
<variable name="accLimitTarget" type="string" description="Restriction d'accès à ces IP/noms d'hôtes (liste séparateur séparateur ',')" />
<variable name="dbClusterGcacheSizeMb" type="number" description="FIXME Gcachesize">
<value>128</value>
<variable name="create_db" type='oui/non' description="Créer des bases de données">
<value>non</value>
</variable>
</family>
<family name="MariaDB Databases">
<variable name="db_name" type='string' description='Nom de la base de donnée' multi="True"/>
<variable name="db_admin_user" type='string' description="Nom de l'utilisateur gestionnaire de la base de données"/>
</family>
<!-- Tunning -->
<family name="DataBase Tunning" mode="expert">
<family name="MariaDB Tunning" mode="expert" icon='mysql-alt'>
<variable name="dbInnoDBBufferPoolPercentage" type="number" description="Pourcentage de mémoire à dédier à MariaDB">
<value>20</value>
</variable>
<variable name="dbInnoDBLogBufferSize" type='number' description="Taille du tampon utilisé pour écrire les fichiers de transaction innodb sur le disque (en Mo)">
<value>8</value>
</variable>
<variable name='dbInnoDBLogFileSize' type='number' description="Taille des fichiers de transaction InnoDB">
<value>6</value>
</variable>
<variable name='dbInnoDBLockWaitTimeout' type='number' description="Nombre de millisecondes d'attente avant de fermer la connection en lock (innodb_lock_wait_timeout)">
<value>120</value>
</variable>
<variable name="dbMaxConnections" type="number" description="Nombre de connection maximum pour le serveur de bases de données (max_connections)">
<value>100</value>
</variable>
@ -92,20 +108,23 @@
<variable name="dbAutoOptimizeAndRepare" type="oui/non" description="Activer l'autoréparation et optimisation de toutes les bases de données">
<value>non</value>
</variable>
<variable name="dbMaxAllowedPacket" type='number' description="Taille maximum d'un paquet (en Mo)">
<value>32</value>
</variable>
<variable name='dbInteractiveTimeout' type='number' description="Nombre de secondes d'attente avant de fermer la connection en mode interactif">
<value>28800</value>
</variable>
</family>
<family name="Database Cluster">
<family name="Grappe MariaDB" icon='mysql-alt'>
<variable name='dbClusterPosition' type='string' description="Rôle dans la grappe" mandatory='True'/>
<variable name='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD"/>
<!-- FIXME : Fill this variable with nom_machine -->
<variable name='nodeName' type='string' description="Nom du noeud local"/>
<variable name='dbClusterMember' type='string' description="Membre de la grappe BDD" multi='True'/>
<variable name='dbClusterMemberIP' type='ip' description="Adresse IP"/>
<!-- Expert Variables -->
<variable name='dbClusterName' type='string' description='Nom de la grappe'>
<value>galera_cluster</value>
</variable>
<variable name='ifDBCluster' type='string' description="Interface réseau dédiée à la grappe BDD" mandatory='True'/>
<variable name='dbClusterMember' type='domain' description="Nom de domaine des membres de la grappe" multi="True" mandatory='True'/>
<variable name="dbClusterMemberIndex" description="Index du serveur dans la liste des membres de la grappe" type="number" mandatory="True"/>
<!-- Expert Variables -->
<variable name='dbBinLogFormat' type='string' mode='expert' description='Format du binlog'>
<value>ROW</value>
</variable>
@ -115,24 +134,28 @@
<variable name='dbSSTMethod' type='string' mode='expert' description='Méthode SST'>
<value>rsync</value>
</variable>
<variable name='dbClusterGcacheSize' type='number' mode='expert' description="Write-set Cache Size (gcache.size)">
<variable name='dbClusterGcacheSizeMb' type='number' mode='expert' description="Write-set Cache Size (gcache.size)">
<value>128</value>
</variable>
<!-- End -->
</family>
<separators>
<separator name='dbCreateFixAdmin'>Comptes d'administration supplémentaires</separator>
<separator name='create_db'>Ajouter des bases de données</separator>
</separators>
</variables>
<constraints>
<check name="valid_ipnetmask" target="maskMariaDBLimit" level="warning">
<param type='eole'>ipMariaDBLimit</param>
</check>
<check name='valid_enum' target='dbBinLogFormat'>
<param>['ROW', 'STATEMENT', 'MIXED', 'NONE']</param>
</check>
<check name='valid_enum' target='ifDBCluster'>
<param>['eth0', 'eth1', 'eth2', 'eth3', 'eth4']</param>
</check>
<group master='dbClusterMember'>
<slave>dbClusterMemberIP</slave>
</group>
<check name='valid_enum' target='accLimits'>
<param>['Default','Custom']</param>
</check>
@ -151,6 +174,10 @@
<slave>ifMariaDBLimit</slave>
</group>
<group master='db_name'>
<slave>db_admin_user</slave>
</group>
<fill name='calc_multi_condition' target='accLimitTarget'>
<param>Default</param>
<param type='eole' name='condition_1'>accLimits</param>
@ -160,12 +187,20 @@
<condition name='disabled_if_in' source="dbEnable">
<param>non</param>
<target type='family'>Database Cluster</target>
<target type='family'>Database</target>
<target type='service_accesslist'>dbCluster</target>
<target type='family'>MariaDB</target>
<!--target type='family'>Grappe MariaDB</target-->
<target type='family'>MariaDB Tunning</target>
<target type='filelist'>dbTunning</target>
<target type='filelist'>dbMariaDB</target>
<!--target type='filelist'>dbCluster</target-->
<target type='servicelist'>bdd</target>
</condition>
<condition name='disabled_if_in' source='create_db'>
<param>non</param>
<target type='family'>MariaDB Databases</target>
</condition>
<condition name='disabled_if_in' source="dbCreateFixAdmin">
<param>non</param>
<target type='variable'>accName</target>
@ -175,7 +210,7 @@
<condition name='disabled_if_in' source="dbEnableCluster">
<param>non</param>
<target type='family'>Database Cluster</target>
<target type='family'>Grappe MariaDB</target>
<target type='service_accesslist'>dbCluster</target>
<target type='filelist'>dbCluster</target>
</condition>

View File

@ -1 +1,3 @@
creolefuncs_DATA_DIR := $(DESTDIR)/usr/share/creole/funcs
schedule_extra_DATA_DIR := $(DESTDIR)/usr/share/eole/creole/extra/schedule/
schedule_config_DATA_DIR := $(DESTDIR)/usr/share/eole/schedule/

11
postservice/00-bdd-cluster Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
set -e
if [[ "$1" == "instance" ]] && [[ "$(CreoleGet dbEnable)" == "oui" ]] && [[ "$(CreoleGet dbEnableCluster)" == "oui" ]] && [[ "$(CreoleGet dbClusterPosition)" == "Leader" ]]
then
service mariadb stop
galera_new_cluster
fi
exit 0

View File

@ -2,6 +2,12 @@
todo=$(CreoleGet dbCreateFixAdmin 'non')
autoRepair=$(CreoleGet dbAutoOptimizeAndRepare 'non')
role=$(CreoleGet dbClusterPosition 'Leader')
if [[ ${role} == 'Node' ]]
then
exit 0
fi
if [[ ${todo} != 'non' ]]
then
@ -13,13 +19,17 @@ then
tempFile=$(mktemp -p /root)
sqlFile=$(mktemp -p /root)
password=$(pwgen -1 10)
/usr/share/eole/sbin/mariadbPwd ${password}
accounts=($(CreoleGet accName))
limits="$(CreoleGet accLimitTarget '')"
accLimits=(${limits// /})
index=0
previousUsers=($(awk -F ':' '{print $1}' ${readerfile} ))
index=0
for user in ${accounts[@]}
do
PASS=$(awk -F ':' "/${user}:/ {print \$2}" ${readerfile})
@ -31,15 +41,21 @@ then
then
hostsList+=(${accLimits[${index}]//,/ })
else
ipAddr=($(CreoleGet ip_my_dist))
ipMask=($(CreoleGet mask_my_dist))
if [[ ${ipMask} == "255.255.255.255" ]]
ipAddr=($(CreoleGet ipMariaDBLimit))
ipMask=($(CreoleGet maskMariaDBLimit))
ix=0
for ip in ${ipAddr[@]}
do
if [[ ${ipMask[${ix}]} == "255.255.255.255" ]]
then
hostsList+=("${ipAddr}")
hostsList+=("${ip}")
else
hostsList+=("${ipAddr}/${ipMask}")
hostsList+=("${ip}/${ipMask[${ix}]}")
fi
ix=$((ix+1))
done
fi
for hst in ${hostsList[@]}
do
SQL="DROP USER IF EXISTS '${user}'@'${hst}';"
@ -55,7 +71,7 @@ then
index=$((index+1))
done
mysql < ${sqlFile}
mysql -u root --password=${password} < ${sqlFile}
mv ${tempFile} ${readerfile}
chmod 600 ${readerfile}
@ -64,8 +80,10 @@ fi
if [[ ${autoRepair} == "oui" ]]
then
mysqlcheck -u root --auto-repair --check --optimize --all-databases
mysqlcheck -u root -p ${password} --auto-repair --check --all-databases
mysqlcheck -u root -p ${password} --optimize --check --all-databases
fi
exit 0

View File

@ -1,16 +0,0 @@
#!/bin/bash
db=$(CreoleGet dbEnable non)
cluster=$(CreoleGet dbEnableCluster non)
role=$(CreoleGet dbClusterPosition 'Node')
gstateFile="/var/lib/mysql/grastate.dat"
if [[ ${db} == "oui" ]]
then
if [[ ${cluster} == "oui" ]]
then
[[ ${role} == "Leader" ]] && galera_new_cluster
fi
fi
exit 0

View File

@ -4,14 +4,23 @@
# and secure MariaDB installation
#
INITDONE="/etc/eole/.galera"
[[ "$(CreoleGet dbEnable)" == "non" ]] && exit 0
[[ -e ${INITDONE} ]] && exit 0
ROLE=$(CreoleGet dbClusterPosition 'Leader')
SECURE_CMD="mysql_secure_installation"
PASSWORD=$(pwgen -1 10)
passwd="/usr/share/eole/sbin/mariadbPwd"
logfile="/var/log/eole/maria-init.log"
logdir="/var/log/eole"
logfile="${logdir}/maria-init.log"
[[ ! -d "${logdir}" ]] && mkdir -p ${logdir}
if [[ ${ROLE} == "Leader" ]]
then
service mysql start
${passwd} ${PASSWORD}
# Run secure installation script
@ -24,6 +33,15 @@ y
y
y
__EOF__
if [[ ${?} -eq 0 ]]
then
service mysql stop
touch ${INITDONE}
exit ${?}
else
service mysql stop
exit ${?}
fi
else
exit 0
fi

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<creole>
<variables>
<family name="mariadb" description="Exportation des bases de données MariaDB">
<variable name="description" type="string" hidden="True"><value>Exportation des bases MariaDB</value></variable>
<variable name="day" type="schedule" description="Périodicité d'exécution"><value>daily</value></variable>
<variable name="mode" type="schedulemod" hidden="True"><value>pre</value></variable>
</family>
</variables>
<constraints>
<fill name='calc_multi_condition' target='schedule.mariadb.day'>
<param>non</param>
<param type='eole' name='condition_1'>dbEnableBackup</param>
<param name='match'>none</param>
<param name='mismatch'>daily</param>
</fill>
</constraints>
</creole>

19
schedule/scripts/mariadb Normal file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e
DESC="Exportation des bases MariaDB"
. /usr/share/eole/schedule/config.sh
MYSQLSAVDIR=$SAVDIR/sql
OPTION="--lock-tables"
if [[ -d ${MYSQLSAVDIR} ]]
then
rm -rf ${MYSQLSAVDIR}
mkdir -p ${MYSQLSAVDIR}
fi
mariabackup --defaults-file=/etc/mysql/debian.cnf --backup --target-dir=$MYSQLSAVDIR
exit $?

View File

@ -6,7 +6,7 @@
cmd="mysql"
options='--defaults-file=/etc/mysql/debian.cnf'
role=$(CreoleGet dbClusterRole 'Leader')
role=$(CreoleGet dbClusterPosition 'Leader')
if [[ ${role} == "Leader" ]]
then

View File

@ -8,12 +8,7 @@ wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
# Galera Cluster Configuration
wsrep_cluster_name="%%dbClusterName"
%set %%nodeIP = %%getVar('adresse_ip_' + %%ifDBCluster, '')
wsrep_cluster_address="gcomm://%%nodeIP%slurp
%for %%node in %%dbClusterMember
,%%node.dbClusterMemberIP%slurp
%end for
"
wsrep_cluster_address="gcomm://%%custom_join(%%dbClusterMember, ',')"
# Tunning
wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
@ -22,5 +17,5 @@ wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
wsrep_sst_method=%%dbSSTMethod
# Galera Node Configuration
wsrep_node_address="%%nodeIP"
wsrep_node_name="%%nodeName"
wsrep_node_address="%%getVar('adresse_ip_' + %%ifDBCluster)"
wsrep_node_name="%%dbClusterMember[%%dbClusterMemberIndex]

21
tmpl/mariadb.cnf Normal file
View File

@ -0,0 +1,21 @@
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
#default-character-set = utf8
[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
#character-set-server = utf8
#collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# Import all .cnf files from configuration directory
plugin-load-add = auth_socket.so
!includedir /etc/mysql/mariadb.conf.d/

View File

@ -3,18 +3,29 @@ innodb_file_per_table=1
skip-name-resolve
innodb_buffer_pool_size=%%getMemoryPercentage(%%getVar('dbInnoDBBufferPoolPercentage', 10))
innodb_log_buffer_size=%%{dbInnoDBLogBufferSize}M
innodb_log_file_size=%%{dbInnoDBLogFileSize}M
innodb_lock_wait_timeout=%%{dbInnoDBLockWaitTimeout}
max_connections=%%dbMaxConnections
thread_cache_size=%%dbThreadCacheSize
%if %%dbCacheQueryEnable == 'oui'
query_cache_type = 1
query_cache_limit = %%getVar('dbQueryCacheLimit')
query_cache_min_res_unit = %%getVar('dbQueryCacheMinResUint')
query_cache_min_res_unit = %%getVar('dbQueryCacheMinRestUnit')
query_cache_size = %%getVar('dbQueryCacheSize')
%else
query_cache_type = 0
query_cache_size = 0
%end if
tmp_table_size = %%dbTmpTableSize
max_heap_table_size = %%dbTmpTableSize
max_allowed_packet = %%{dbMaxAllowedPacket}M
wait_timeout = %%dbWaitTimeout
interactive_timeout = %%{dbInteractiveTimeout}
%if %%dbEnableSlowQueryLogs == "oui"
slow-query-log = 1
@ -22,5 +33,4 @@ slow-query-log-file = %%getVar('dbSlowQueryLogFile')
long_query_time = %%getVar('dbSlowQueryLogTime')
%end if
wait_timeout = %%dbWaitTimeout