Problem statement: My application will be deployed in 3 separate regions, viz: North America, Europe, and Asia. I want to build a redis architecture with the following constraints:
Let me elaborate a bit on the second point: I want that all regions should have their own copy of data. So any new data that an application in Europe writes should go to a redis cluster in Europe region not in any other region. And then this data can be (asynchronously) replicated to Asia and North America region.
What I've found as of now is that I can't use redis sentinel as I want mutliple masters. I can't use (I think) redis cluster with masters on separate regions as this would shard the data across all regions, thereby application in Europe can try to write on a key which is sharded on a redis master in Asia.
So my Question is: Is this architecuture possible with Redis OS right now(), or in near future?
I've read this, this, and this on SO stating this feature was not previously available but, It seems this feature is available in Redis Entireprise here though, I couldn't find anything on this topic for open source version of Redis.
One possible solution can be to use redis keys hash tags with one redis master in each region like redis_master_US, redis_master_europe, etc. and slaves in multiple regions (to improve read performance and availability) where keys can be such {US}_California, {US}_Texas, {EU}_Germany, {ASIA}_Japan, etc. But the catch here is that all keys with the prefix US will go to the same redis master but not necessarily redis_master_US, which depends on the hash slot distribution between redis masters. Now there is a way to get around that, if we use premeditated redis key hash tags as can be found here.
Now we can use a key like, {fyimk7v1CgnBo}_California, {fyimk7v1CgnBo}_Texas, {91Lnyl}_Germany, {6MQu4Y}_Japan, which we know will point to slot 0, 16382, 8325 respectively and while making a cluster make sure these slots are assigned to redis_master_US, redis_master_Germany, and redis_master_asia respectively.
Though this approach seems to entail lot of gotchas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With