Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mysql:scripts [2009/01/06 13:06]
a Pretty InnoDB Buffer Pool Stats
mysql:scripts [2009/05/25 00:35] (current)
Line 87: Line 87:
 done done
 </code> </code>
 +
  
 ===== Sniff the MySQL traffic on the fly ===== ===== Sniff the MySQL traffic on the fly =====
Line 101: Line 102:
 </code> </code>
  
 +===== RESET SLAVE =====
  
 +<code bash|f reset-mysql-slave.sh>
 +#!/bin/bash
 +
 +HOST=$1
 +RPASS=$(<passwordfile)
 +
 +IFS="
 +"
 +
 +mysql -h $HOST -e "STOP SLAVE"
 +
 +for line in $(mysql -e "SHOW SLAVE STATUS" -E -h $HOST)
 + do
 + key=${line%:*}  # Split off what goes before :
 + key=${key// }   # And trim spaces
 + data=${line#*:} # Split off what goes after :
 + data=${data// } # And trim spaces yet again!!! 
 +
 + case $key in
 + Exec_master_log_pos) LOGPOS=$data;;
 + Relay_Master_Log_File) LOGFILE=$data;;
 + Master_Host) RHOST=$data;;
 + Master_User) RUSER=$data;;
 + esac
 +
 + done
 +
 +if [ -z $LOGPOS -o -z $LOGFILE ]; then
 +        echo "OMG FAIL NO POSITIONS KNOWN"; exit;
 +fi 
 +
 +mysql -f -h $HOST -e "
 +        RESET SLAVE;
 +        CHANGE MASTER TO
 +                MASTER_HOST='$RHOST',
 +                MASTER_USER='$RUSER',
 +                MASTER_PASSWORD='$RPASS',
 +                MASTER_LOG_FILE='$LOGFILE',
 +                MASTER_LOG_POS=$LOGPOS ;
 +        START SLAVE
 +        "
 +</code>
  
mysql/scripts.1231243619.txt.gz ยท Last modified: 2009/05/25 00:34 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready