Compare commits
8 Commits
pkg/dev/eo
...
0ab65611b0
Author | SHA1 | Date | |
---|---|---|---|
0ab65611b0 | |||
52eadb6bf1 | |||
44629b4587 | |||
b1bcd05792 | |||
efc3f5848c | |||
d19bfdebf9 | |||
a199b9182d | |||
d87c9ee307 |
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
|
|
25
scripts/get_tables_sizes.sh
Executable file
25
scripts/get_tables_sizes.sh
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
(
|
||||||
|
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
|
||||||
|
SELECT
|
||||||
|
TABLE_NAME AS \`Table\`,
|
||||||
|
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS \`Size\`
|
||||||
|
FROM
|
||||||
|
information_schema.TABLES
|
||||||
|
WHERE
|
||||||
|
TABLE_SCHEMA = "hydra"
|
||||||
|
ORDER BY
|
||||||
|
(DATA_LENGTH + INDEX_LENGTH)
|
||||||
|
DESC;
|
||||||
|
EOF
|
||||||
|
) | while read table size; do
|
||||||
|
if [ "${table}" != Table ]; then
|
||||||
|
real_size=$(ls -lh /var/lib/mysql/hydra/${table}.ibd | cut -d' ' -f 5)
|
||||||
|
else
|
||||||
|
real_size="Taille réelle"
|
||||||
|
fi
|
||||||
|
echo -e ${table}\\t${size}M\\t${real_size}
|
||||||
|
done
|
||||||
|
|
||||||
|
echo $a
|
49
scripts/optimize_hydra
Executable file
49
scripts/optimize_hydra
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Optimize sur les tables d'Hydra
|
||||||
|
|
||||||
|
echo "Begin date: $(date)"
|
||||||
|
|
||||||
|
part=$1
|
||||||
|
|
||||||
|
if [ -z "$part" ]; then
|
||||||
|
echo 'Bad empty part. Please give a number between 1 and 7'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $part in
|
||||||
|
1)
|
||||||
|
tables='hydra_oauth2_access'
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
tables='hydra_oauth2_oidc'
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
tables='hydra_oauth2_code'
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
tables='hydra_oauth2_authentication_request'
|
||||||
|
;;
|
||||||
|
5)
|
||||||
|
tables='hydra_oauth2_consent_request'
|
||||||
|
;;
|
||||||
|
6)
|
||||||
|
tables='hydra_oauth2_logout_request, hydra_oauth2_consent_request_handled'
|
||||||
|
;;
|
||||||
|
7)
|
||||||
|
tables='hydra_oauth2_authentication_session, hydra_oauth2_authentication_request_handled, hydra_oauth2_pkce'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unexpected error. Part: $part"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
mysql --defaults-file=/etc/mysql/debian.cnf hydra <<EOF
|
||||||
|
OPTIMIZE TABLE $tables;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
exit_val=$?
|
||||||
|
|
||||||
|
echo "End date: $(date)"
|
||||||
|
|
||||||
|
exit $exit_val
|
Reference in New Issue
Block a user