Sha256: bb62c8227d576432eaceb4c207873ed9c9d1f4d5114686b0bac4ae3dd50ca8c7
Contents?: true
Size: 629 Bytes
Versions: 1
Compression:
Stored size: 629 Bytes
Contents
module RedisFailover # Provides manual failover support to a new master. module Manual extend self # Path for manual failover communication. ZNODE_PATH = '/redis_failover_manual'.freeze # Denotes that any slave can be used as a candidate for promotion. ANY_SLAVE = "ANY_SLAVE".freeze def failover(zk, options = {}) create_path(zk) node = options.empty? ? ANY_SLAVE : "#{options[:host]}:#{options[:port]}" zk.set(ZNODE_PATH, node) end private def create_path(zk) zk.create(ZNODE_PATH) rescue ZK::Exceptions::NodeExists # best effort end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redis_failover-0.8.0 | lib/redis_failover/manual.rb |