Compare commits
11 Commits
pkg/dev/eo
...
develop
Author | SHA1 | Date | |
---|---|---|---|
03ce27c7f2 | |||
d0284ccbe4 | |||
38de7274ba | |||
44629b4587 | |||
b1bcd05792 | |||
efc3f5848c | |||
d19bfdebf9 | |||
a199b9182d | |||
d87c9ee307 | |||
0327098015 | |||
4ee18114f4 |
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.6
|
EOLE_VERSION=2.7
|
||||||
EOLE_RELEASE=2.6.2
|
EOLE_RELEASE=2.7.1
|
||||||
PKGAPPS=non
|
PKGAPPS=non
|
||||||
#FLASK_MODULE=<APPLICATION>
|
#FLASK_MODULE=<APPLICATION>
|
||||||
|
|
||||||
|
26
README.md
26
README.md
@ -1,5 +1,31 @@
|
|||||||
# 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
|
||||||
|
@ -49,7 +49,13 @@
|
|||||||
<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>
|
||||||
|
</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>
|
</family>
|
||||||
|
|
||||||
<!-- Tunning -->
|
<!-- Tunning -->
|
||||||
@ -135,6 +141,7 @@
|
|||||||
</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>
|
||||||
@ -167,6 +174,10 @@
|
|||||||
<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>
|
||||||
@ -185,6 +196,11 @@
|
|||||||
<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>
|
||||||
|
@ -28,6 +28,8 @@ 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})
|
||||||
@ -54,7 +56,6 @@ 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}';"
|
||||||
@ -86,4 +87,3 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
#!/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
|
|
||||||
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
|
|
19
schedule/scripts/mariadb
Normal file
19
schedule/scripts/mariadb
Normal 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 $?
|
@ -1,7 +0,0 @@
|
|||||||
# 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
|
|
@ -1,27 +0,0 @@
|
|||||||
#!/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,7 @@ 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://%%dbClusterMember
|
wsrep_cluster_address="gcomm://%%custom_join(%%dbClusterMember, ',')"
|
||||||
|
|
||||||
# Tunning
|
# Tunning
|
||||||
wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
|
wsrep_provider_options="gcache.size=%%dbClusterGcacheSizeMb"
|
||||||
|
Reference in New Issue
Block a user