Class: Mysql

Inherits:
Database show all
Includes:
Utils
Defined in:
lib/cryo/database/mysql.rb

Overview

this has all of the logic to perform an entire dump of a remote rds host

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#delete_file, #get_age_from_key_name, #get_tempfile, #get_timstamped_key_name, #get_utc_time, #get_utc_time_from_key_name, #get_utc_timestamp, #gzip_file, #need_to_archive?, #safe_run, #ungzip_file, #verify_system_dependency

Methods inherited from Database

create

Constructor Details

#initialize(opts = {}) ⇒ Mysql

Returns a new instance of Mysql.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cryo/database/mysql.rb', line 8

def initialize(opts={})
  raise "you need to specify a password" unless opts[:password]
  self.password = opts[:password]
  raise "you need to specify a host" unless opts[:host]
  self.host = opts[:host]
  raise "you need to specify a tmp path" unless opts[:tmp_path]
  self.tmp_path = opts[:tmp_path]
  self.user = opts[:user] || 'ubuntu'
  self.port = opts[:port] || '3306'
  self.local_path = opts[:local_path] || get_tempfile
  verify_system_dependency 'mysqldump'
end

Instance Attribute Details

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/cryo/database/mysql.rb', line 6

def host
  @host
end

#local_pathObject

Returns the value of attribute local_path.



6
7
8
# File 'lib/cryo/database/mysql.rb', line 6

def local_path
  @local_path
end

#passwordObject

Returns the value of attribute password.



6
7
8
# File 'lib/cryo/database/mysql.rb', line 6

def password
  @password
end

#portObject

Returns the value of attribute port.



6
7
8
# File 'lib/cryo/database/mysql.rb', line 6

def port
  @port
end

#tmp_pathObject

Returns the value of attribute tmp_path.



6
7
8
# File 'lib/cryo/database/mysql.rb', line 6

def tmp_path
  @tmp_path
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/cryo/database/mysql.rb', line 6

def user
  @user
end

Instance Method Details

#get_backupObject

run through all of the necessary steps to perform a backup



22
23
24
25
# File 'lib/cryo/database/mysql.rb', line 22

def get_backup()
  get_dump
  local_path
end

#get_gzipped_backupObject



27
28
29
30
# File 'lib/cryo/database/mysql.rb', line 27

def get_gzipped_backup
  get_and_gzip_dump
  local_path
end