Class: Bungee::Backup

Inherits:
Object
  • Object
show all
Defined in:
lib/bungee/backup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Backup

Returns a new instance of Backup.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bungee/backup.rb', line 9

def initialize(options = {})
  @index = options[:index]
  @elasticsearch_url = options[:elasticsearch_url] || 'http://localhost:9200'
  @data_path = options[:data_path]
  @backup_path = options[:backup_path]

  @hosts = Rye::Set.new('default', :safe => false)
  boxes = options[:hosts].map { |host| Rye::Box.new(host, :safe => false) }
  @first_host = boxes.first
  @hosts.add_boxes(boxes)
end

Instance Attribute Details

#clusterObject (readonly)

Returns the value of attribute cluster.



7
8
9
# File 'lib/bungee/backup.rb', line 7

def cluster
  @cluster
end

#data_pathObject (readonly)

Returns the value of attribute data_path.



7
8
9
# File 'lib/bungee/backup.rb', line 7

def data_path
  @data_path
end

#elasticsearch_urlObject (readonly)

Returns the value of attribute elasticsearch_url.



7
8
9
# File 'lib/bungee/backup.rb', line 7

def elasticsearch_url
  @elasticsearch_url
end

#first_hostObject (readonly)

Returns the value of attribute first_host.



7
8
9
# File 'lib/bungee/backup.rb', line 7

def first_host
  @first_host
end

#hostsObject (readonly)

Returns the value of attribute hosts.



7
8
9
# File 'lib/bungee/backup.rb', line 7

def hosts
  @hosts
end

#indexObject (readonly)

Returns the value of attribute index.



7
8
9
# File 'lib/bungee/backup.rb', line 7

def index
  @index
end

Instance Method Details

#backup!Object



21
22
23
24
25
26
27
# File 'lib/bungee/backup.rb', line 21

def backup!
  flush_index
  disable_translog_flushing
  rsync_index_locally
  enable_translog_flushing
  merge_shards_to_backup_path
end