Sha256: 276377839e14341ab717a1ad5f6757aec9e643df9948e1432b91b1bc6d536181
Contents?: true
Size: 1.12 KB
Versions: 21
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 #{@config[:dbpath]} #{uncompressed} && gzip #{uncompressed}" end def set_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 @config = { :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
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
dumper-1.1.0 | lib/dumper/database/redis.rb |