Sha256: 534763665f752d1f1fee53e3fd68835a6508c7470fd393c0cb3b0b014223d8f5
Contents?: true
Size: 1.12 KB
Versions: 3
Compression:
Stored size: 1.12 KB
Contents
module Dumper module Database class Redis < Base DUMP_TOOL = 'redis-cli' FILE_EXT = 'rdb.gz' def command uncompressed = filename.sub('.gz','') "cd #{tmpdir} && cp #{@stack.configs[:redis][:dbpath]} #{uncompressed} && gzip #{uncompressed}" end 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 end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dumper-0.3.0 | lib/dumper/database/redis.rb |
dumper-0.2.2 | lib/dumper/database/redis.rb |
dumper-0.2.0 | lib/dumper/database/redis.rb |