Redis create cluster issue
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.6k
- Forks
- 2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 40
Description
Hello,
I have a Redis MemoryDB cluster with 2 nodes in AWS and I'm trying to connect to it through createCluster, but the connection isn't established.
Here is how I try to connect:
import { createCluster } from 'redis';
(async () => {
const REDIS_USERNAME = 'test-username';
const REDIS_PASSWORD = 'test-pass';
const cluster = createCluster({
rootNodes: [
{
url: `rediss://redis-region-0001-001.amazonaws.com:6379`,
username: REDIS_USERNAME,
password: REDIS_PASSWORD,
},
{
url: `rediss://redis-region-0001-002.amazonaws.com:6379`,
username: REDIS_USERNAME,
password: REDIS_PASSWORD,
},
]
});
cluster.on('error', (err) => console.log('Redis Cluster Error', err));
console.log('before connection');
await cluster.connect();
console.log('connected to cluster...');
await cluster.set('key', 'value');
const value = await cluster.get('key');
console.log(value);
await cluster.disconnect();
})();
The log connected to cluster... is never showed up.
If I add in the configuration of createCluster to the defaults option the master node endpoint like this:
defaults: {
url: `rediss://redis-region-0001-001.amazonaws.com:6379`,
username: REDIS_USERNAME,
password: REDIS_PASSWORD,
}
The connection is established and everything works fine!
Why do I need the defaults option? Shouldn't it work only with rootNodes?
Thank you!
Environment:
- Node.js Version: 16-alpine3.12
- Redis Server Version: 6
- Node Redis Version: 4.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the createCluster entry point and reproduce the connection behavior with Redis 4.0.0 against the AWS MemoryDB setup described, comparing rootNodes-only configuration with defaults. Done means explaining whether rootNodes alone should connect and adding a regression test or documenting the confirmed limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, redis, typescript
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100