I have to dump mysql databases and transfer it to other server (im using mysqldump and rsync). Now I doing it step by step:
- dump database A (~25 minutes)
- transfer database A (~30 minutes )
- dump database B (~35 minutes)
- transfer database B (~45 minutes)
- ... So for 7 database it takes something about 10 hours
bazy=("ast" "biog" "dbaut" "tran2" "dest" "recor" "senti")
place="/backup"
function dump { /usr/bin/mysqldump -u $user -p$password $baza | gzip -$cl -c > $place/$baza.sql.gz; }
function transfer { rsync -Pav -e "ssh -i /usr/src/migration/ky" $place/$baza.sql.gz ro***@$dst:/backup/; }
function remove { rm $place/$baza.sql.gz -f; }
for baza in ${bazy[@]}; do
echo $baza
dump
transfer
remove
done
Is there any way to do this paralelly? - while database A is transfered in the same time dumping database B, etc.