sr-scripts 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/sr-start-slave CHANGED
@@ -8,6 +8,9 @@ require 'ostruct'
8
8
  connection = Fog::Compute.new(:provider => "AWS", :region => "us-west-1")
9
9
  sdb = Fog::AWS::SimpleDB.new()
10
10
 
11
+ #STUPID HACK because the RPM install starts the server
12
+ `/sbin/service mysql stop`
13
+
11
14
  # somewhere up here check to see if the devices are already attached
12
15
 
13
16
  p connection.snapshots.all.first
@@ -34,6 +37,8 @@ end
34
37
 
35
38
  rows.sort! { |a,b| b.timestamp <=> a.timestamp }
36
39
 
40
+ master_log_file = nil
41
+ master_log_pos = nil
37
42
  latest_snapshots = nil
38
43
  rows.each do |r|
39
44
  if latest_snapshots != nil
@@ -48,6 +53,8 @@ rows.each do |r|
48
53
  end
49
54
  if pending == false
50
55
  latest_snapshots = r.snapshots.split(",")
56
+ master_log_file = r.master_log_file
57
+ master_log_pos = r.master_log_pos
51
58
  end
52
59
 
53
60
  end
@@ -118,9 +125,9 @@ else
118
125
  # `mount -t xfs /dev/md0 /mnt/mysql`
119
126
  end
120
127
 
121
- #`service mysql start`
128
+ `/sbin/service mysql start`
122
129
 
123
- #`mysql -e "CHANGE MASTER TO MASTER_HOST='#{current_master.private_ip_address}', MASTER_LOG_FILE='binarylogs.006693', MASTER_LOG_POS=785268118;"`
130
+ `mysql -e "CHANGE MASTER TO MASTER_HOST='#{current_master.private_ip_address}', MASTER_LOG_FILE='#{master_log_file}', MASTER_LOG_POS=#{master_log_pos};"`
124
131
  # start mysql, connect to mysql and issue change master and start slave commands
125
132
 
126
133
  #NEED TO TAG THE INSTANCE THAT STARTED WITH SOME OF THE INFO FROM THE CURRENT MASTER
@@ -1,5 +1,5 @@
1
1
  module Sr
2
2
  module Scripts
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sr-scripts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Davy Campano