image

MySQL Server Replication

[<Back>] [<Edit>]

Automated MySQL Server Replication using Sh / mysqldump You can also use this for 2+ Slaves

#!/bin/sh

#Not for Scale out, See "Replication" on the MySQL manual. (Tutorial to come)

#Run this script on the SLAVE(s)

TMP_DIR=/tmp
dumpDATE=$(eval date +%Y-%m-%d-TIME-%H%M)

mysqldump -h <MasterSQL_IP> -u<remote> -p<password> --all-databases > /$TMP_DIR/$dumpDATE.sql
mysql -u<remote> -p<password> < /$TMP_DIR/$dumpDATE.sql

#Add it to Cron and you can forget about it.





By: Ted Simbajon





 
Instagram Stats
pinoy
my Kung Fu