Produced by Araxis Merge on 10/2/2017 1:40:11 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | chef-repo.zip\chef-repo\third_party_cookbooks\mysql\test\fixtures\cookbooks\mysql_replication_test\recipes | default.rb | Fri Oct 2 00:39:01 2015 UTC |
| 2 | chef-repo.zip\chef-repo\third_party_cookbooks\mysql\test\fixtures\cookbooks\mysql_replication_test\recipes | default.rb | Mon Oct 2 15:37:36 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 12 | 238 |
| Changed | 11 | 32 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | require 's hellwords' | |
| 2 | ||
| 3 | # variable s | |
| 4 | root_pass = 'MyPa$$w ordHasSpec ialChars!' | |
| 5 | ||
| 6 | # master | |
| 7 | mysql_serv ice 'maste r' do | |
| 8 | port ' PORT ' | |
| 9 | initial_ root_passw ord root_p ass | |
| 10 | action [ :create, : start] | |
| 11 | end | |
| 12 | ||
| 13 | mysql_conf ig 'master replicati on' do | |
| 14 | config_n ame 'repli cation' | |
| 15 | instance 'master' | |
| 16 | source ' replicatio n-master.e rb' | |
| 17 | variable s(server_i d: '1', my sql_instan ce: 'maste r') | |
| 18 | notifies :restart, 'mysql_se rvice[mast er]', :imm ediately | |
| 19 | action : create | |
| 20 | end | |
| 21 | ||
| 22 | # slave-1 | |
| 23 | mysql_serv ice 'slave -1' do | |
| 24 | port ' PORT ' | |
| 25 | initial_ root_passw ord root_p ass | |
| 26 | action [ :create, : start] | |
| 27 | end | |
| 28 | ||
| 29 | mysql_conf ig 'replic ation-slav e-1' do | |
| 30 | instance 'slave-1' | |
| 31 | source ' replicatio n-slave.er b' | |
| 32 | variable s(server_i d: '2', my sql_instan ce: 'slave -1') | |
| 33 | notifies :restart, 'mysql_se rvice[slav e-1]', :im mediately | |
| 34 | action : create | |
| 35 | end | |
| 36 | ||
| 37 | # slave-2 | |
| 38 | mysql_serv ice 'slave -2' do | |
| 39 | port ' PORT ' | |
| 40 | initial_ root_passw ord root_p ass | |
| 41 | action [ :create, : start] | |
| 42 | end | |
| 43 | ||
| 44 | mysql_conf ig 'replic ation-slav e-2' do | |
| 45 | instance 'slave-2' | |
| 46 | source ' replicatio n-slave.er b' | |
| 47 | variable s(server_i d: '3', my sql_instan ce: 'slave -2') | |
| 48 | notifies :restart, 'mysql_se rvice[slav e-2]', :im mediately | |
| 49 | action : create | |
| 50 | end | |
| 51 | ||
| 52 | # Create u ser repl o n master | |
| 53 | bash 'crea te replica tion user' do | |
| 54 | code <<- EOF | |
| 55 | /usr/bin/m ysql -u ro ot -h 127. 0.0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -D my sql -e "CR EATE USER 'repl'@'12 7.0.0.1' I DENTIFIED BY 'RE D A C TE D ';" | |
| 56 | /usr/bin/m ysql -u ro ot -h 127. 0.0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -D my sql -e "GR ANT REPLIC ATION SLAV E ON *.* T O 'repl'@' 127.0.0.1' ;" | |
| 57 | EOF | |
| 58 | not_if "/u sr/bin/mys ql -u root -h 127.0. 0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -e 's elect User ,Host from mysql.use r' | grep repl" | |
| 59 | action : run | |
| 60 | end | |
| 61 | ||
| 62 | # take a d ump | |
| 63 | bash 'crea te /root/d ump.sql' d o | |
| 64 | user 'ro ot' | |
| 65 | code <<- EOF | |
| 66 | mysqld ump \ | |
| 67 | --defa ults-file= /etc/mysql -master/my .cnf \ | |
| 68 | -u roo t \ | |
| 69 | --prot ocol=tcp \ | |
| 70 | -p#{Sh ellwords.e scape(root _pass)} \ | |
| 71 | --skip -lock-tabl es \ | |
| 72 | --sing le-transac tion \ | |
| 73 | --flus h-logs \ | |
| 74 | --hex- blob \ | |
| 75 | --mast er-data=2 \ | |
| 76 | -A \ > /root/dum p.sql; | |
| 77 | EOF | |
| 78 | not_if { ::File.ex ist?('/roo t/dump.sql ') } | |
| 79 | action : run | |
| 80 | end | |
| 81 | ||
| 82 | # stash re plication start posi tion on th e filesyst em | |
| 83 | bash 'stas h position in /root/ position' do | |
| 84 | user 'ro ot' | |
| 85 | code <<- EOF | |
| 86 | head / root/dump. sql -n80 \ | |
| 87 | | grep 'MASTER_L OG_POS' \ | |
| 88 | | awk '{ print $ 6 }' \ | |
| 89 | | cut -f2 -d '=' \ | |
| 90 | | cut -f1 -d';' \ | |
| 91 | > /roo t/position | |
| 92 | EOF | |
| 93 | not_if { ::File.ex ist?('/roo t/position ') } | |
| 94 | action : run | |
| 95 | end | |
| 96 | ||
| 97 | # import d ump into s laves | |
| 98 | bash 'slav e-1 import ' do | |
| 99 | user 'ro ot' | |
| 100 | code "/usr /bin/mysql -u root - h 127.0.0. 1 -P PORT -p#{Shell words.esca pe(root_pa ss)} < /ro ot/dump.sq l" | |
| 101 | not_if "/u sr/bin/mys ql -u root -h 127.0. 0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -e 's elect User ,Host from mysql.use r' | grep repl" | |
| 102 | action : run | |
| 103 | end | |
| 104 | ||
| 105 | bash 'slav e-2 import ' do | |
| 106 | user 'ro ot' | |
| 107 | code "/usr /bin/mysql -u root - h 127.0.0. 1 -P PORT -p#{Shell words.esca pe(root_pa ss)} < /ro ot/dump.sq l" | |
| 108 | not_if "/u sr/bin/mys ql -u root -h 127.0. 0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -e 's elect User ,Host from mysql.use r' | grep repl" | |
| 109 | action : run | |
| 110 | end | |
| 111 | ||
| 112 | # start re plication on slave-1 | |
| 113 | ruby_block 'start_sl ave_1' do | |
| 114 | block { start_slav e_1 } # li braries/he lpers.rb | |
| 115 | not_if "/u sr/bin/mys ql -u root -h 127.0. 0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -e 'S HOW SLAVE STATUS\G' | grep Sla ve_IO_Stat e" | |
| 116 | action : run | |
| 117 | end | |
| 118 | ||
| 119 | # start re plication on slave-2 | |
| 120 | ruby_block 'start_sl ave_2' do | |
| 121 | block { start_slav e_2 } # li braries/he lpers.rb | |
| 122 | not_if "/u sr/bin/mys ql -u root -h 127.0. 0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -e 'S HOW SLAVE STATUS\G' | grep Sla ve_IO_Stat e" | |
| 123 | action : run | |
| 124 | end | |
| 125 | ||
| 126 | # create d atabass on master | |
| 127 | bash 'crea te databas s' do | |
| 128 | code <<- EOF | |
| 129 | echo 'CREA TE DATABAS E databass ;' | /usr/ bin/mysql -u root -h 127.0.0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)}; | |
| 130 | echo 'CREA TE TABLE d atabass.ta ble1 (name VARCHAR(2 0), rank V ARCHAR(20) );' | /usr /bin/mysql -u root - h 127.0.0. 1 -P PORT -p#{Shell words.esca pe(root_pa ss)}; | |
| 131 | echo "INSE RT INTO da tabass.tab le1 (name, rank) VALU ES('captai n','awesom e');" | /u sr/bin/mys ql -u root -h 127.0. 0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)}; | |
| 132 | EOF | |
| 133 | not_if "/u sr/bin/mys ql -u root -h 127.0. 0.1 -P PORT -p#{Shell words.esca pe(root_pa ss)} -e 's how databa ses' | gre p databass " | |
| 134 | action : run | |
| 135 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.