question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Representing Amazon ElasticCache (no cluster)

See original GitHub issue

I have AWS ElasticCache Redis (no cluster) with replications. I have an application that needs to connect only to slaves for reads and scale reads across the multiple slaves. I read through your API and it seems to me that I should list all slaves as sentinels and specify role as slave? I couldn’t figure out how to scale reads across slaves; is this supported?

var redis = new Redis({
  sentinels: [{ host: '127.0.0.1', port: 26379 }, { host: '127.0.0.1', port: 26380 }],
  name: 'mymaster',
  role: 'slave',
 readOnly: true
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
luincommented, Apr 6, 2017

No, there’s no built-in way for this. However, it’s possible for you to create multiple connections to your replication (each for a slave), and route the queries to random connections. For example:

const slaves = [
  new Redis(/**/),
  new Redis(/**/),
  new Redis(/**/)
]

import {sample} from 'lodash'
sample(slaves).get('foo')
0reactions
sanket-naik-zocdoccommented, Apr 6, 2017

That is a really good alternative… thanks for the suggestion!
I would close this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Replication: Redis (Cluster Mode Disabled) vs. Redis (Cluster ...
A Redis (cluster mode disabled) cluster always has a single shard (API/CLI: ... If you have no replicas and the node fails, you...
Read more >
Amazon Elasticache FAQs - Amazon Web Service
You can choose to configure a 500-node cluster that ranges between 83 shards (one master and five replicas per shard) and 500 shards...
Read more >
How to work with Cluster Mode on Amazon ElastiCache for ...
Open the AWS Management Console in your favorite browser and navigate to ElastiCache. Click the blue “Create” button towards the middle of the ......
Read more >
Monitoring best practices with Amazon ElastiCache for Redis ...
This post shows you how to maintain a healthy Redis cluster and prevent disruption using Amazon CloudWatch and other external tools.
Read more >
Auto Scaling ElastiCache for Redis clusters
Auto Scaling in ElastiCache for Redis is not supported for clusters running in Global datastores, Outposts or Local Zones. AWS Auto Scaling for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found