I'd like to suggest adding an option for replication so that this can be run on slaves servers using replication.
Some of my larger databases were taking a long time to backup. Now I use replication and conduct backups on my slave.
Add this to the start
# Are we running this on a slave server? SLAVE_SERVER=yes
if [ "$SLAVE_SERVER" = "yes" ]; then mysqladmin --user=$USERNAME --password=$PASSWORD stop-slave fi
and this to the end if [ "$SLAVE_SERVER" = "yes" ]; then mysqladmin --user=$USERNAME --password=$PASSWORD start-slave fi
Why not just use the PREBACKUP and POSTBACKUP which are already there?
PREBACKUP="cp /etc/my.cnf $BACKUPDIR ; mysqldump --version ; mysql -e \"show slave status\G\" ; mysqladmin stop-slave flush-tables flush-logs flush-status"
POSTBACKUP="mysqladmin start-slave"
Log in to post a comment.
I'd like to suggest adding an option for replication so that this can be run on slaves servers using replication.
Some of my larger databases were taking a long time to backup. Now I use replication and conduct backups on my slave.
Add this to the start
# Are we running this on a slave server?
SLAVE_SERVER=yes
if [ "$SLAVE_SERVER" = "yes" ]; then
mysqladmin --user=$USERNAME --password=$PASSWORD stop-slave
fi
and this to the end
if [ "$SLAVE_SERVER" = "yes" ]; then
mysqladmin --user=$USERNAME --password=$PASSWORD start-slave
fi
Why not just use the PREBACKUP and POSTBACKUP which are already there?
PREBACKUP="cp /etc/my.cnf $BACKUPDIR ; mysqldump --version ; mysql -e \"show slave status\G\" ; mysqladmin stop-slave flush-tables flush-logs flush-status"
POSTBACKUP="mysqladmin start-slave"