Compare commits
33 Commits
master
...
pkg/dev/eo
Author | SHA1 | Date | |
---|---|---|---|
c540b65e08 | |||
5e9eae5c13 | |||
b4cccc5e12 | |||
68eaa03db2 | |||
5c7bbbde79 | |||
ed910e72ee | |||
142d73afad | |||
08d7ed927c | |||
f375a121ae | |||
4709c28223 | |||
98bfcc1416 | |||
ae696769ed | |||
534e04671a | |||
61383bb17a | |||
5aa0262331 | |||
b550833a25 | |||
517625cf66 | |||
7a9855f234 | |||
764ae6320c | |||
d9425736c6 | |||
cbb1319e48 | |||
be88b407b4 | |||
c87a989b22 | |||
d1e813aaa8 | |||
eb6854d313 | |||
c723edd095 | |||
37e5cbb3b2 | |||
4d00207271 | |||
5e98dafab2 | |||
1fb5fd21b8 | |||
8cf9168763 | |||
0dfdb70080 | |||
6d4b75c679 |
4
Makefile
4
Makefile
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
SOURCE=eole-mariadb
|
SOURCE=eole-mariadb
|
||||||
VERSION=0.0.1
|
VERSION=0.0.1
|
||||||
EOLE_VERSION=2.7
|
EOLE_VERSION=2.6
|
||||||
EOLE_RELEASE=2.7.1
|
EOLE_RELEASE=2.6.2
|
||||||
PKGAPPS=non
|
PKGAPPS=non
|
||||||
#FLASK_MODULE=<APPLICATION>
|
#FLASK_MODULE=<APPLICATION>
|
||||||
|
|
||||||
|
26
README.md
26
README.md
@ -1,31 +1,5 @@
|
|||||||
# eole-mariadb
|
# 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.
|
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
|
La version utilisé est mariadb 10.3
|
||||||
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
9
|
18
debian/control
vendored
Normal file
18
debian/control
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
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
Normal file
44
debian/copyright
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
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
Normal file
3
debian/gbp.conf
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Set per distribution debian tag
|
||||||
|
[DEFAULT]
|
||||||
|
debian-tag = debian/eole/%(version)s
|
8
debian/rules
vendored
Executable file
8
debian/rules
vendored
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# Uncomment this to turn on verbose mode.
|
||||||
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
BIN
debian/source/.format.un~
vendored
Normal file
BIN
debian/source/.format.un~
vendored
Normal file
Binary file not shown.
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.0 (native)
|
@ -2,38 +2,39 @@
|
|||||||
<files>
|
<files>
|
||||||
<file filelist='dbMariaDB' name='/etc/mysql/conf.d/mariadb.cnf' rm='True' mkdir='True'/>
|
<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='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'/>
|
|
||||||
|
|
||||||
|
<file filelist='dbTunning' name='/etc/mysql/conf.d/tunning.cnf' rm='True' mkdir='True'/>
|
||||||
<service servicelist='bdd'>mariadb</service>
|
<service servicelist='bdd'>mariadb</service>
|
||||||
<service_access service='mariadb'>
|
<service_access service='mariadb'>
|
||||||
<port protocol='tcp'>3306</port>
|
<port service_accesslist='mariadb' protocol='tcp'>3306</port>
|
||||||
<tcpwrapper>mariadb</tcpwrapper>
|
<tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
|
||||||
</service_access>
|
</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'>
|
<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'>4444</port>
|
||||||
<port service_accesslist='dbCluster' protocol='tcp'>4567</port>
|
<port service_accesslist='dbCluster' protocol='tcp'>4567</port>
|
||||||
<port service_accesslist='dbCluster' protocol='tcp'>4568</port>
|
<port service_accesslist='dbCluster' protocol='tcp'>4568</port>
|
||||||
<port service_accesslist='dbCluster' protocol='udp'>4567</port>
|
<port service_accesslist='dbCluster' protocol='udp'>4567</port>
|
||||||
|
<tcpwrapper service_accesslist='mariadb'>mariadb</tcpwrapper>
|
||||||
</service_access>
|
</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_restriction service='galera'>
|
<service_restriction service='galera'>
|
||||||
<ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMember</ip>
|
<ip interface='ifDBCluster' interface_type="SymLinkOption" netmask='255.255.255.255' ip_type='SymLinkOption'>dbClusterMemberIP</ip>
|
||||||
</service_restriction>
|
</service_restriction>
|
||||||
</files>
|
</files>
|
||||||
<variables>
|
<variables>
|
||||||
<family name="Services">
|
<family name="Services">
|
||||||
<variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'>
|
<variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'>
|
||||||
<value>oui</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="dbEnableBackup" type='oui/non' description='Activer la sauvegarde sur le serveur de base de données MariaDB'>
|
<variable name="dbEnableBackup" type='oui/non' description='Activer la sauvegarde sur le serveur de base de données MariaDB'>
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
<family name="MariaDB" icon='mysql-alt'>
|
<family name="Database">
|
||||||
<variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?">
|
<variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
@ -49,17 +50,14 @@
|
|||||||
<value>Default</value>
|
<value>Default</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="accLimitTarget" type="string" description="Restriction d'accès à ces IP/noms d'hôtes (liste séparateur séparateur ',')" />
|
<variable name="accLimitTarget" type="string" description="Restriction d'accès à ces IP/noms d'hôtes (liste séparateur séparateur ',')" />
|
||||||
<variable name="create_db" type='oui/non' description="Créer des bases de données">
|
|
||||||
<value>non</value>
|
<variable name="dbClusterGcacheSizeMb" type="number" description="FIXME Gcachesize">
|
||||||
|
<value>128</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</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 -->
|
<!-- Tunning -->
|
||||||
<family name="MariaDB Tunning" mode="expert" icon='mysql-alt'>
|
<family name="Database Tunning" mode="expert">
|
||||||
<variable name="dbInnoDBBufferPoolPercentage" type="number" description="Pourcentage de mémoire à dédier à MariaDB">
|
<variable name="dbInnoDBBufferPoolPercentage" type="number" description="Pourcentage de mémoire à dédier à MariaDB">
|
||||||
<value>20</value>
|
<value>20</value>
|
||||||
</variable>
|
</variable>
|
||||||
@ -116,15 +114,18 @@
|
|||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
|
||||||
<family name="Grappe MariaDB" icon='mysql-alt'>
|
<family name="Database Cluster">
|
||||||
<variable name='dbClusterPosition' type='string' description="Rôle dans la grappe" mandatory='True'/>
|
<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'>
|
<variable name='dbClusterName' type='string' description='Nom de la grappe'>
|
||||||
<value>galera_cluster</value>
|
<value>galera_cluster</value>
|
||||||
</variable>
|
</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'>
|
<variable name='dbBinLogFormat' type='string' mode='expert' description='Format du binlog'>
|
||||||
<value>ROW</value>
|
<value>ROW</value>
|
||||||
</variable>
|
</variable>
|
||||||
@ -134,28 +135,28 @@
|
|||||||
<variable name='dbSSTMethod' type='string' mode='expert' description='Méthode SST'>
|
<variable name='dbSSTMethod' type='string' mode='expert' description='Méthode SST'>
|
||||||
<value>rsync</value>
|
<value>rsync</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name='dbClusterGcacheSizeMb' type='number' mode='expert' description="Write-set Cache Size (gcache.size)">
|
<variable name='dbClusterGcacheSize' type='number' mode='expert' description="Write-set Cache Size (gcache.size)">
|
||||||
<value>128</value>
|
<value>128</value>
|
||||||
</variable>
|
</variable>
|
||||||
<!-- End -->
|
<!-- End -->
|
||||||
</family>
|
</family>
|
||||||
<separators>
|
<separators>
|
||||||
<separator name='dbCreateFixAdmin'>Comptes d'administration supplémentaires</separator>
|
<separator name='dbCreateFixAdmin'>Comptes d'administration supplémentaires</separator>
|
||||||
<separator name='create_db'>Ajouter des bases de données</separator>
|
|
||||||
</separators>
|
</separators>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<check name="valid_ipnetmask" target="maskMariaDBLimit" level="warning">
|
<check name="valid_ipnetmask" target="maskMariaDBLimit" level="warning">
|
||||||
<param type='eole'>ipMariaDBLimit</param>
|
<param type='eole'>ipMariaDBLimit</param>
|
||||||
</check>
|
</check>
|
||||||
|
|
||||||
<check name='valid_enum' target='dbBinLogFormat'>
|
|
||||||
<param>['ROW', 'STATEMENT', 'MIXED', 'NONE']</param>
|
|
||||||
</check>
|
|
||||||
<check name='valid_enum' target='ifDBCluster'>
|
<check name='valid_enum' target='ifDBCluster'>
|
||||||
<param>['eth0', 'eth1', 'eth2', 'eth3', 'eth4']</param>
|
<param>['eth0', 'eth1', 'eth2', 'eth3', 'eth4']</param>
|
||||||
</check>
|
</check>
|
||||||
|
|
||||||
|
<group master='dbClusterMember'>
|
||||||
|
<slave>dbClusterMemberIP</slave>
|
||||||
|
</group>
|
||||||
|
|
||||||
<check name='valid_enum' target='accLimits'>
|
<check name='valid_enum' target='accLimits'>
|
||||||
<param>['Default','Custom']</param>
|
<param>['Default','Custom']</param>
|
||||||
</check>
|
</check>
|
||||||
@ -174,10 +175,6 @@
|
|||||||
<slave>ifMariaDBLimit</slave>
|
<slave>ifMariaDBLimit</slave>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group master='db_name'>
|
|
||||||
<slave>db_admin_user</slave>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
<fill name='calc_multi_condition' target='accLimitTarget'>
|
<fill name='calc_multi_condition' target='accLimitTarget'>
|
||||||
<param>Default</param>
|
<param>Default</param>
|
||||||
<param type='eole' name='condition_1'>accLimits</param>
|
<param type='eole' name='condition_1'>accLimits</param>
|
||||||
@ -187,20 +184,16 @@
|
|||||||
|
|
||||||
<condition name='disabled_if_in' source="dbEnable">
|
<condition name='disabled_if_in' source="dbEnable">
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<target type='family'>MariaDB</target>
|
<target type='family'>Database</target>
|
||||||
<!--target type='family'>Grappe MariaDB</target-->
|
<target type='family'>Database Cluster</target>
|
||||||
<target type='family'>MariaDB Tunning</target>
|
<target type='family'>Database Tunning</target>
|
||||||
|
<target type='service_accesslist'>dbCluster</target>
|
||||||
<target type='filelist'>dbTunning</target>
|
<target type='filelist'>dbTunning</target>
|
||||||
<target type='filelist'>dbMariaDB</target>
|
<target type='filelist'>dbMariaDB</target>
|
||||||
<!--target type='filelist'>dbCluster</target-->
|
<target type='filelist'>dbCluster</target>
|
||||||
<target type='servicelist'>bdd</target>
|
<target type='servicelist'>bdd</target>
|
||||||
</condition>
|
</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">
|
<condition name='disabled_if_in' source="dbCreateFixAdmin">
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<target type='variable'>accName</target>
|
<target type='variable'>accName</target>
|
||||||
@ -210,7 +203,7 @@
|
|||||||
|
|
||||||
<condition name='disabled_if_in' source="dbEnableCluster">
|
<condition name='disabled_if_in' source="dbEnableCluster">
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
<target type='family'>Grappe MariaDB</target>
|
<target type='family'>Database Cluster</target>
|
||||||
<target type='service_accesslist'>dbCluster</target>
|
<target type='service_accesslist'>dbCluster</target>
|
||||||
<target type='filelist'>dbCluster</target>
|
<target type='filelist'>dbCluster</target>
|
||||||
</condition>
|
</condition>
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
#!/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
|
|
@ -28,8 +28,6 @@ then
|
|||||||
|
|
||||||
previousUsers=($(awk -F ':' '{print $1}' ${readerfile} ))
|
previousUsers=($(awk -F ':' '{print $1}' ${readerfile} ))
|
||||||
|
|
||||||
index=0
|
|
||||||
|
|
||||||
for user in ${accounts[@]}
|
for user in ${accounts[@]}
|
||||||
do
|
do
|
||||||
PASS=$(awk -F ':' "/${user}:/ {print \$2}" ${readerfile})
|
PASS=$(awk -F ':' "/${user}:/ {print \$2}" ${readerfile})
|
||||||
@ -56,6 +54,7 @@ then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
index=0
|
||||||
for hst in ${hostsList[@]}
|
for hst in ${hostsList[@]}
|
||||||
do
|
do
|
||||||
SQL="DROP USER IF EXISTS '${user}'@'${hst}';"
|
SQL="DROP USER IF EXISTS '${user}'@'${hst}';"
|
||||||
@ -87,3 +86,4 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
20
posttemplate/25-bdd-cluster
Executable file
20
posttemplate/25-bdd-cluster
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/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
|
||||||
|
if [[ ${role} == "Leader" ]]
|
||||||
|
then
|
||||||
|
service mariadb stop
|
||||||
|
galera_new_cluster
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
66
posttemplate/25-mariadb-passwd
Executable file
66
posttemplate/25-mariadb-passwd
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
systemctl stop mariadb
|
||||||
|
|
||||||
|
mariadb_cfdir=/etc/mysql/
|
||||||
|
dc=$mysql_cfgdir/mariadbBackup.cnf
|
||||||
|
mariadb_rundir=/var/run/mysqld/
|
||||||
|
mariadb_statedir=/var/lib/mysql
|
||||||
|
|
||||||
|
if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then
|
||||||
|
pass="`sed -n 's/^[ ]*password *= *// p' $dc | head -n 1`"
|
||||||
|
# Basedir is deprecated. Remove the option if it's in an existing mariadbBackup.cnf
|
||||||
|
sed -i '/basedir/d' "$dc"
|
||||||
|
else
|
||||||
|
pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`;
|
||||||
|
if [ ! -d "$mariadb_cfdir" ]; then
|
||||||
|
then install -o 0 -g 0 -m 0755 -d $mariadb_cfdir
|
||||||
|
fi
|
||||||
|
umask 066
|
||||||
|
cat /dev/null > $dc
|
||||||
|
umask 022
|
||||||
|
echo "# Automatically generated DONT'T TOUCH !!!!!!" >>$dc
|
||||||
|
echo "[client]" >>$dc
|
||||||
|
echo "host = localhost" >>$dc
|
||||||
|
echo "user = maria-sys-maint" >>$dc
|
||||||
|
echo "password = $pass" >>$dc
|
||||||
|
echo "socket = $mariadb_rundir/mysqld.sock" >>$dc
|
||||||
|
echo "[mysql_upgrade]" >>$dc
|
||||||
|
echo "host = localhost" >>$dc
|
||||||
|
echo "user = maria-sys-maint" >>$dc
|
||||||
|
echo "password = $pass" >>$dc
|
||||||
|
echo "socket = $mariadb_rundir/mysqld.sock" >>$dc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If this dir chmod go+w then the admin did it. But this file should not.
|
||||||
|
chown 0:0 $dc
|
||||||
|
chmod 0600 $dc
|
||||||
|
|
||||||
|
# If database doesn't exist we create it.
|
||||||
|
mkdir /var/lib/mariadb-files
|
||||||
|
mariadb_filesdir=/var/lib/mariadb-files
|
||||||
|
|
||||||
|
if [ ! "$(ls -A "${mariadb_statedir}")" ] && [ -d "${mariadb_filesdir}" ]; then
|
||||||
|
existingdatabase=0
|
||||||
|
initfile=`mktemp --tmpdir=/var/lib/mariadb-files/`
|
||||||
|
touch "$initfile"
|
||||||
|
chmod 600 "$initfile"
|
||||||
|
chown mysql:mysql "$initfile"
|
||||||
|
echo "USE mysql; " >> "$initfile"
|
||||||
|
db_get mysql-server/root_password && rootpw="$RET"
|
||||||
|
if [ ! -z "$rootpw" ]; then
|
||||||
|
rootpw=$(printf %q "${rootpw}")
|
||||||
|
echo "ALTER USER 'root'@'localhost' IDENTIFIED BY '$rootpw';" >> "$initfile"
|
||||||
|
fi
|
||||||
|
echo "CREATE USER IF NOT EXISTS 'maria-sys-maint'@'localhost' IDENTIFIED BY '$pass';" >> "$initfile"
|
||||||
|
echo "GRANT ALL ON *.* TO 'maria-sys-maint'@'localhost' WITH GRANT OPTION;" >> "$initfile"
|
||||||
|
echo "SHUTDOWN;" >> "$initfile"
|
||||||
|
mysqld --initialize-insecure --user=mysql --init-file="$initfile"> /dev/null 2>&1 || true
|
||||||
|
rm "$initfile"
|
||||||
|
else
|
||||||
|
existingdatabase=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start mariadb
|
||||||
|
|
||||||
|
exit 0
|
@ -1,19 +0,0 @@
|
|||||||
#!/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 $?
|
|
7
schedule_config/config.sh
Normal file
7
schedule_config/config.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Configuration commune aux scripts schedule
|
||||||
|
# Configuration de base modifiée pour copier dans le partage nfs plutôt que /home
|
||||||
|
|
||||||
|
SAVDIR=/mnt/sauvegardes/
|
||||||
|
# pour que l'affichage de [ ok ] soit ok
|
||||||
|
export TERM='dumb'
|
||||||
|
umask 0077
|
27
schedule_scripts/mariadb
Normal file
27
schedule_scripts/mariadb
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DESC="Exportation des bases MariaDB"
|
||||||
|
|
||||||
|
. /usr/share/eole/schedule/config.sh
|
||||||
|
|
||||||
|
MYSQLSAVDIR=$SAVDIR/sql
|
||||||
|
OPTION="--lock-tables"
|
||||||
|
|
||||||
|
rm -f $MYSQLSAVDIR/*.sql
|
||||||
|
mkdir -p $MYSQLSAVDIR
|
||||||
|
|
||||||
|
CMD="mysql --defaults-file=/etc/mysql/mariadbBackup.cnf -e 'show databases' | grep -v '^Database$'"
|
||||||
|
DATABASES=$(CreoleRun "$CMD" mysql)
|
||||||
|
for databasename in $DATABASES; do
|
||||||
|
case "$databasename" in
|
||||||
|
information_schema|performance_schema|bareos)
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CMD="mysqldump --defaults-file=/etc/mysql/mariadbBackup.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null"
|
||||||
|
CreoleRun "$CMD" mysql > $MYSQLSAVDIR/$databasename.sql
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
@ -8,7 +8,12 @@ wsrep_on=ON
|
|||||||
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
wsrep_provider=/usr/lib/galera/libgalera_smm.so
|
||||||
# Galera Cluster Configuration
|
# Galera Cluster Configuration
|
||||||
wsrep_cluster_name="%%dbClusterName"
|
wsrep_cluster_name="%%dbClusterName"
|
||||||
wsrep_cluster_address="gcomm://%%custom_join(%%dbClusterMember, ',')"
|
%set %%nodeIP = %%getVar('adresse_ip_' + %%ifDBCluster, '')
|
||||||
|
wsrep_cluster_address="gcomm://%%nodeIP%slurp
|
||||||
|
%for %%node in %%dbClusterMember
|
||||||
|
,%%node.dbClusterMemberIP%slurp
|
||||||
|
%end for
|
||||||
|
"
|
||||||
|
|
||||||
# Tunning
|
# Tunning
|
||||||
wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
|
wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
|
||||||
@ -17,5 +22,5 @@ wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
|
|||||||
wsrep_sst_method=%%dbSSTMethod
|
wsrep_sst_method=%%dbSSTMethod
|
||||||
|
|
||||||
# Galera Node Configuration
|
# Galera Node Configuration
|
||||||
wsrep_node_address="%%getVar('adresse_ip_' + %%ifDBCluster)"
|
wsrep_node_address="%%nodeIP"
|
||||||
wsrep_node_name="%%dbClusterMember[%%dbClusterMemberIndex]
|
wsrep_node_name="%%nodeName"
|
Loading…
x
Reference in New Issue
Block a user