Ioredis: Globally distributed sentinel setup - picking local redis server for reads and master for writes

Created on 9 Feb 2018  路  2Comments  路  Source: luin/ioredis

Hi,
I have a globally distributed web app which uses a sentinel based redis slave/master replication setup for caching data which can be applicable to all clients.

I would like to share this cache among all web app servers whilst maintaining a low (read: as low as absolutely possible) latency on read requests.

My ideal situation would be:

Node A - EU-East
Node B - EU-West
Node C - US-West
Node D - US-East
Node E - Aus

If a request is made on Node D and Node A has the master redis server, I would like the read to be handled by Node D, however if Node D has to make a write request it has to be passed on to the master.

I can see clustering has read/write splitting, however the sentinel replicated side of things doesn't. Would it be possible to implement this? Clustering wouldn't work for us because there's no guarantee which server the data is held on (as it is sharded) and thus there's no way to keep latency at its lowest.

The below would work well for the reading from the local server, however the write-request would not work as it would be trying to write to a slave..... correct?

var redis = new Redis({
sentinels: [{ host: 'localhost', port: 26379 }, 
    { host: 'eu-west-1', port: 26379 }, 
    { host: 'eu-east-1', port: 26379 }],
  name: 'globalRedisCache',
  preferredSlaves: [{ ip: '127.0.0.1', port: '6379', prio: 1 }]
});

Thanks,
Alex Matthews

wontfix

Most helpful comment

That is a really obnoxious bot. Just because someone hasn't responded doesn't mean an issue should be closed. It just encourages people to 'bump' threads to make sure the overzealous bucket-of-bolts doesn't unduly close their post.

P.S. - bump

All 2 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 7 days if no further activity occurs, but feel free to re-open a closed issue if needed.

That is a really obnoxious bot. Just because someone hasn't responded doesn't mean an issue should be closed. It just encourages people to 'bump' threads to make sure the overzealous bucket-of-bolts doesn't unduly close their post.

P.S. - bump

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfee picture dfee  路  4Comments

kimmobrunfeldt picture kimmobrunfeldt  路  5Comments

eduleboss picture eduleboss  路  3Comments

ORESoftware picture ORESoftware  路  5Comments

haoxins picture haoxins  路  5Comments