Class: Dumper::Database::Redis
- Defined in:
- lib/dumper/database/redis.rb
Constant Summary collapse
- DUMP_TOOL =
'redis-cli'
- FILE_EXT =
'rdb.gz'
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#dump_path, #dump_tool_path, #file_ext, #finalize, #initialize
Methods included from Utility::ObjectFinder
#find_instance_in_object_space
Constructor Details
This class inherits a constructor from Dumper::Database::Base
Instance Method Details
#command ⇒ Object
7 8 9 10 |
# File 'lib/dumper/database/redis.rb', line 7 def command uncompressed = filename.sub('.gz','') "cd #{tmpdir} && cp #{@stack.configs[:redis][:dbpath]} #{uncompressed} && gzip #{uncompressed}" end |
#config_for(rails_env = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dumper/database/redis.rb', line 12 def config_for(rails_env=nil) return unless defined?(::Redis) && (main_thread_redis = find_instance_in_object_space(::Redis)) client = main_thread_redis.client # New connection for the agent thread redis = ::Redis.new(:host => client.host, :port => client.port, :password => client.password, :db => client.db) dir = redis.config(:get, :dir)['dir'] dbfilename = redis.config(:get, :dbfilename)['dbfilename'] dbpath = "#{dir}/#{dbfilename}" return unless File.exist?(dbpath) # Redis must run on the back up node { :host => client.host, :port => client.port, :password => client.password, :database => client.db, :dump_tool => dump_tool_path, :dbpath => dbpath } end |