Class: Maatkit::SlaveDelay

Inherits:
Object
  • Object
show all
Defined in:
lib/maatkit-ruby/mk-slave-delay.rb

Overview

Make a MySQL slave server lag behind its master.

Maatkit::SlaveDelay.new( array, str, array)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSlaveDelay

Returns a new SlaveDelay Object



45
46
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 45

def initialize()
end

Instance Attribute Details

#ask_passObject

FALSE



15
16
17
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 15

def ask_pass
  @ask_pass
end

#charsetObject

(No # value)



16
17
18
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 16

def charset
  @charset
end

#configObject

/etc/maatkit/maatkit.conf,/etc/maatkit/mk_slave_delay.conf,/home/joel/.maatkit.conf,/home/joel/.mk_slave_delay.conf



17
18
19
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 17

def config
  @config
end

#continueObject

TRUE



18
19
20
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 18

def continue
  @continue
end

#daemonizeObject

FALSE



19
20
21
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 19

def daemonize
  @daemonize
end

#defaults_fileObject

(No # value)



20
21
22
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 20

def defaults_file
  @defaults_file
end

#delayObject

3600



21
22
23
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 21

def delay
  @delay
end

#helpObject

TRUE



22
23
24
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 22

def help
  @help
end

#hostObject

(No # value)



23
24
25
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 23

def host
  @host
end

#intervalObject

60



24
25
26
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 24

def interval
  @interval
end

#logObject

(No # value)



25
26
27
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 25

def log
  @log
end

#passwordObject

(No # value)



26
27
28
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 26

def password
  @password
end

#path_to_mk_slave_delayObject

Sets the executable path, otherwise the environment path will be used.



40
41
42
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 40

def path_to_mk_slave_delay
  @path_to_mk_slave_delay
end

#pidObject

(No # value)



27
28
29
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 27

def pid
  @pid
end

#portObject

(No # value)



28
29
30
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 28

def port
  @port
end

#quietObject

FALSE



29
30
31
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 29

def quiet
  @quiet
end

#run_timeObject

(No # value)



30
31
32
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 30

def run_time
  @run_time
end

#set_varsObject

wait_timeout=10000



31
32
33
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 31

def set_vars
  @set_vars
end

#socketObject

(No # value)



32
33
34
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 32

def socket
  @socket
end

#use_masterObject

FALSE



33
34
35
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 33

def use_master
  @use_master
end

#userObject

(No # value)



34
35
36
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 34

def user
  @user
end

#versionObject

FALSE



35
36
37
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 35

def version
  @version
end

Instance Method Details

#start(options = nil) ⇒ Object

Execute the command



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/maatkit-ruby/mk-slave-delay.rb', line 51

def start(options = nil)
  tmp = Tempfile.new('tmp')
  command = option_string() + options.to_s + " 2> " + tmp.path
  success = system(command)
  if success
    begin
      while (line = tmp.readline)
        line.chomp
        selected_string = line
      end
    rescue EOFError
      tmp.close
    end
    return selected_string
  else
    tmp.close!
    return success
  end
end