Created
April 12, 2013 03:05
-
-
Save bageljp/5369006 to your computer and use it in GitHub Desktop.
MySQL Tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MYSQL_USER="mysql" | |
MYSQL_PASS="password" | |
MYSQL_HOST_MASTER[0]="192.168.0.1" | |
MYSQL_HOST_MASTER[1]="192.168.0.2" | |
MYSQL_HOST_SLAVE[0]="192.168.0.2" | |
MYSQL_HOST_SLAVE[1]="192.168.0.3" | |
echo "------------------" | |
echo "### MASTER HOST ###" | |
for host in ${MYSQL_HOST_MASTER[@]}; do | |
echo -n " ### $host : " | |
mysql -u "${MYSQL_USER}" -p"${MYSQL_PASS}" -h ${host} -e 'show master status\G' | grep "Pos" | awk '{print $NF}' | |
done | |
echo "------------------" | |
echo "### SLAVE HOST ###" | |
for host in ${MYSQL_HOST_SLAVE[@]}; do | |
echo -n " ### $host : " | |
mysql -u "${MYSQL_USER}" -p"${MYSQL_PASS}" -h ${host} -e 'show slave status\G' | grep "Exec_Master_Log_Pos" | awk '{print $NF}' | |
done | |
echo "------------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.percona.com/doc/percona-toolkit/2.1/pt-heartbeat.html