Skip to content

Connection URL support for Cluster constructor #1794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

steprescott
Copy link

@steprescott steprescott commented Aug 10, 2023

Currently to pass multiple startup nodes it can only be done by passing them as separate items in the array.

This PR adds support to allow for multiple hosts to be configured if they appear in a URL string.

Discussion points

I've tried to be light touch and assume as little as possible but a few points to think over:

  • If a url of rediss://node-1,node-2 was given would you assume all connections are using tls?
  • If a url contained options redis://node-1,node-2/1?key=value should it copy all options over to all nodes?
  • Should we add | string to Cluster constructer to allow it to be created using a URL string. Redis.Cluster("redis://node-1")

At the moment it does none of these and just takes what is supplied and continues to keep all assumptions made by ioredis as I've only added a parsing check for commas and then separate them into their own startupNode.

Happy to discuss your thoughts on the approach.

Resolves #1519

@steprescott
Copy link
Author

@luin Sorry if this is not the right approach but do I need to tag you or someone else to start the review process? I wasn't sure after reading the contribution section of the README.md.

@steprescott
Copy link
Author

@luin just bumping this in hope it can be reviewed. If you need anything further from me please do let me know.

@elena-kolevska
Copy link

Hi @steprescott, I'm sorry for the very late reply and I'm fully aware you might not be interested or able to work on the PR anymore, but I wanted to give an update anyway, for posterity.
There is an ongoing initiative to standardise the URIs across all the Redis client libraries. Once the spec is complete, we can share it here and help adapt the PR to it.

Thank you very much for your contribution 🙏

@steprescott
Copy link
Author

No problem. Thanks for the reply.

@andyjones
Copy link

thank you @elena-kolevska, Are there any time frames or places to find out more about the standardisation effort? I couldn't see anything on https://github.com/redis/redis-specifications

We have a self-hosted option for our product that uses Redis so keen to align our implementation with any plans.

@elena-kolevska
Copy link

Yeah, it's still WIP, but here's the current state: https://github.com/redis/redis-specifications/blob/master/uri/redis.txt

@andyjones
Copy link

Thank you! Are there any plans or discussions around standardising Redis Cluster and Sentinel urls as they aren't covered by the current state?

For example:

  1. will sentinel URLs have a special format? eg. redis+sentinel://
  2. will cluster URLs have a separate format? eg. redis+cluster://
  3. will multi-host be supported? eg. redis+cluster://redis-0,redis-1,redis-2

Appreciate that discussions are on-going so it may change but any insight is useful!

@headlessme
Copy link
Contributor

It would be really useful to have cluster and sentinel support in the URL standardisation, as well as multiple host support. @elena-kolevska we'd be happy to contribute to a standardisation effort, and provide a JS implementation supporting these things, or just provide feedback on the standardisation work towards this.

@elena-kolevska
Copy link

It would be really useful to have cluster and sentinel support in the URL standardisation, as well as multiple host support. @elena-kolevska we'd be happy to contribute to a standardisation effort, and provide a JS implementation supporting these things, or just provide feedback on the standardisation work towards this.

@mortensi can you provide some info here? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connection URL support for Cluster constructor
4 participants