Ajout scripts pour voir et réduire la taille des tables hydra
This commit is contained in:
parent
52eadb6bf1
commit
0ab65611b0
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue