redis / redis/node-redis

Support SRV records

Open
#2,088 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
TypeScript
Stars
17.6k
Forks
2k
Avg merge
2d 3h
Merged PRs (30d)
40

Description

Suppose we have multiple environments -- staging, production, development.

In each environment, we have a different redis server. However, I don't want to change the code of my application -- I want the application to connect to a host, redis-server, and have it reach the correct server. I can do this with CNAMEs. However, each server is running on a different port: staging, port 8362; production, port 19872; development, 6379. This is because we're using a hosting provider for our redis instances.

I still don't want to have to change the configuration or code to connect to the proper redis instance.

Enter DNS SRV records: the record contains a target and a port.
redis-server.staging.my-environment.com -> SRV 0 10 8362 redis-192.hosted.redis-provider.com (priority, weight, port, target [name])

I would like to be able to tell redis to connect to simply redis-server, allow the machine's searchdomains DNS list to expand that to redis-server.staging.my-environment.com, allow the redis connector to do a DNS lookup for the SRV record, and then connect to the appropriate server and port:

const client = createClient({
    url: 'redis://alice:foobar@redis-server'
  });

and with just the above, the infrastructure would control the reference to the redis server for that environment.

See also:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the createClient URL connection handling and review Node.js dns.resolveSrv, as referenced in the issue. Support redis:// hosts that resolve through SRV records, including the resolved target and port, and verify that the client connects to the environment-specific Redis server.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, redis, typescript
Domain
backend, database, networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.