~gandelman-a/pyjuju/mysql

« back to all changes in this revision

Viewing changes to hooks/slave-relation-changed

  • Committer: Clint Byrum
  • Date: 2011-05-30 08:18:32 UTC
  • Revision ID: clint@ubuntu.com-20110530081832-mby3twnv00w1m8aj
fixing order of operations so slave starts up w/ params set correctly

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    eval $setting=$value
25
25
done
26
26
 
 
27
dumpurl=http://$ip/$dumpurl
 
28
echo Stopping slave...
 
29
mysql $ROOTARGS -e "STOP SLAVE"
 
30
 
27
31
# Normally this will be empty anyway, but it will save our admin
28
32
# if he accidentally relates a master with some other master!
29
33
backup=/var/backups/alldbs-`date +%Y%m%d%H%M%S`.sql.gz
30
34
mysqldump $ROOTARGS --all-databases --single-transaction |gzip> $backup
31
35
 
32
 
dumpurl=http://$ip/$dumpurl
33
 
echo Stopping slave...
34
 
mysql $ROOTARGS -e "STOP SLAVE"
35
36
mysql $ROOTARGS -e "RESET SLAVE"
 
37
mysql $ROOTARGS -e "CHANGE MASTER TO MASTER_HOST='$ip', MASTER_USER='$user', MASTER_PASSWORD='$password', MASTER_PORT=$port"
36
38
echo Importing $dumpurl into MySQL
37
39
curl --silent --show-error $dumpurl |zcat| mysql $ROOTARGS
38
40
# Root pw gets overwritten by import
61
63
  mv $binlog* $backupdir || :
62
64
  service mysql start
63
65
fi
64
 
mysql $ROOTARGS -e "STOP SLAVE"
65
 
mysql $ROOTARGS -e "CHANGE MASTER TO MASTER_HOST='$ip', MASTER_USER='$user', MASTER_PASSWORD='$password', MASTER_PORT=$port"
66
66
mysql $ROOTARGS -e "START SLAVE"
67
67
mysql $ROOTARGS -e "SHOW SLAVE STATUS"