Skip to content

proxy that read from redis(or ssdb) write to both use for redis <=> ssdb migration on production

License

Notifications You must be signed in to change notification settings

falm/redis-ssdb-proxy

Repository files navigation

Redis SSDB Proxy Build Status Coverage Status Code Climate Dependency Status Gem Version

The Redis SSDB Proxy that read from redis(or ssdb) write to both use for redis <=> ssdb migration on production

Installation

Add this line to your application's Gemfile:

gem 'redis-ssdb-proxy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install redis-ssdb-proxy

Usage

If you want migrate redis data to SSDB the below code will write data to both of redis and ssdb and read from redis only

The options ssdb: :slave tells Proxy which redis-client is connected to the ssdb server which means Proxy will be delegating the unsupport data-structure (set) of SSDB to supported(zset)

ssdb = Redis.new(host: 'localhost', port: '8888')
redis = Redis.new(host: 'localhost', port: '6379')

$redis = RedisSsdbProxy.new(master: redis, slave: ssdb, ssdb: :slave)

$redis.set(:quotes, 'May the force be with you') # set to both
$redis.get(:quotes) # read from master (redis)
# => May the force be with you

When the data migrated the below line code will being prepare for the rollback

$redis = RedisSsdbProxy.new(master: ssdb, slave: redis, ssdb: :master)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/falm/redis-ssdb-proxy.

License

MIT © Falm

About

proxy that read from redis(or ssdb) write to both use for redis <=> ssdb migration on production

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published