Created
December 21, 2010 05:08
-
-
Save jeffgca/749526 to your computer and use it in GitHub Desktop.
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
desc "get Master" | |
task :get_master_info, :roles => :new do | |
run 'echo "SHOW MASTER STATUS" | mysql -u root --password=root_pass' do |ch, stream, data| | |
set :master_info, data.split("\n").pop().split("\t") | |
end | |
set_master | |
end | |
desc "Set Master on Slave" | |
task :set_master, :roles => :old do | |
set :sql, "CHANGE MASTER TO MASTER_HOST='some.host', MASTER_USER='user', MASTER_PASSWORD='some_pa55', MASTER_LOG_FILE='#{master_info[0]}', MASTER_LOG_POS=#{master_info[1]};" | |
# puts sql | |
put(sql, "/tmp/master.sql") | |
run "cat /tmp/master.sql | mysql -u root --password=root_pass" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Number 1 in a continuing series of things you probably shouldn't do with Capistrano.