Skip to content

Commit 1aae57c

Browse files
committed
Do booby/tern in parallel whilst running backed up scripts.
1 parent b70507a commit 1aae57c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

dories/restore-database.sh

+19-17
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,32 @@ for type in 0 1 2 3 4 5; do
2525
for db in smf lm2 ukgpl views; do
2626
sort =(${=SSH_DATADUMP} "ls -1 /var/backup/mysql/srou-booby/mysql/gizmo71_${db}-${type}_*.sql.gz") | while read sql; do
2727
echo "** Processing $(basename $sql)..."
28-
DB_HOST="--host ${SROU_DB_HOST}"
29-
${=SSH_DATADUMP} "zcat $sql" </dev/null | sed --regexp-extended -e "s/(DEFAULT CHARSET=|CHARACTER SET )latin1([; ])/\1utf8\2/g" \
30-
-e "s/XX(!50001 CREATE ALGORITHM=\S+\s+)/Ignore \1 - stupid bugs in dump and restore of views /g" \
31-
-e "s/XX(!50013 DEFINER=\S+@\S+ SQL SECURITY INVOKER)/Ignore \1 - user isn't local /g" \
32-
-e "s/(ENGINE=)DISABLED_MyISAM /\1InnoDB /g" \
33-
-e "s%https?://(www\.)simracing\.org\.uk%https://${SROU_HOST_WWW}%g" \
34-
-e "s%https?://replays\.simracing\.org\.uk%https://${SROU_HOST_REPLAY}%g" \
35-
-e "s%https?://downloads\.simracing\.org\.uk%https://${SROU_HOST_WWW}/downloads%g" \
36-
-e "s%https?://(www\.)?ukgpl\.com%https://${SROU_HOST_UKGPL}%g" |
37-
mysql ${=SHARED_OPTIONS} ${=MIGRATE_LOGIN} ${=DB_HOST} gizmo71_${db}
28+
DB_HOST="--host=${single_db} --port=${MYSQL_PORT}"
3829
(
39-
if [ $type = 1 ]; then
30+
echo "SET sql_log_bin = 0;"
31+
${=SSH_DATADUMP} "zcat $sql" </dev/null | sed --regexp-extended -e "s/(DEFAULT CHARSET=|CHARACTER SET )latin1([; ])/\1utf8\2/g" \
32+
-e "s/XX(!50001 CREATE ALGORITHM=\S+\s+)/Ignore \1 - stupid bugs in dump and restore of views /g" \
33+
-e "s/XX(!50013 DEFINER=\S+@\S+ SQL SECURITY INVOKER)/Ignore \1 - user isn't local /g" \
34+
-e "s/(ENGINE=)DISABLED_MyISAM /\1InnoDB /g" \
35+
-e "s%https?://(www\.)simracing\.org\.uk%https://${SROU_HOST_WWW}%g" \
36+
-e "s%https?://replays\.simracing\.org\.uk%https://${SROU_HOST_REPLAY}%g" \
37+
-e "s%https?://downloads\.simracing\.org\.uk%https://${SROU_HOST_WWW}/downloads%g" \
38+
-e "s%https?://(www\.)?ukgpl\.com%https://${SROU_HOST_UKGPL}%g"
39+
# if [ $type = 1 ]; then
4040
# if [ $db = smf ]; then
4141
# echo "ALTER TABLE gizmo71_smf.smf_messages PARTITION BY KEY (ID_MSG) PARTITIONS 10;"
4242
# echo "ALTER TABLE gizmo71_smf.smf_personal_messages PARTITION BY KEY (ID_PM) PARTITIONS 4;"
4343
# elif [ $db = lm2 ]; then
4444
# echo "ALTER TABLE gizmo71_lm2.lm2_event_entries PARTITION BY KEY (id_event_entry) PARTITIONS 10;"
4545
# fi
46-
elif [ $type = 2 ]; then
47-
sleep 15 # Give replication a chance to work
48-
echo "FLUSH LOGS;"
49-
echo "PURGE BINARY LOGS BEFORE (NOW() - INTERVAL 30 MINUTE);"
50-
fi
51-
) | mysql ${=SHARED_OPTIONS} ${=MIGRATE_LOGIN} ${=DB_HOST}
46+
# elif [ $type = 2 ]; then
47+
# sleep 15 # Give replication a chance to work
48+
# echo "FLUSH LOGS;"
49+
# echo "PURGE BINARY LOGS BEFORE (NOW() - INTERVAL 30 MINUTE);"
50+
# fi
51+
) | tee >(mysql ${=SHARED_OPTIONS} ${=MIGRATE_LOGIN} --host=booby.aquarium.davegymer.org --port=${MYSQL_PORT} gizmo71_${db}) \
52+
>(mysql ${=SHARED_OPTIONS} ${=MIGRATE_LOGIN} --host=tern.aquarium.davegymer.org --port=${MYSQL_PORT} gizmo71_${db}) \
53+
>/dev/null
5254
done
5355
done
5456
done

0 commit comments

Comments
 (0)