StackExchange / StackExchange/StackExchange.Redis

Feature request for supporting connecting to individual nodes with hostname in cluster mode

Open
#2,791 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.2k
Forks
1.6k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Context:

Starting from redis 7.x. two new properties cluster-preferred-endpoint-type and cluster-announce-hostname properties have been added. When cluster-preferred-endpoint-type is set to hostname, Moved and Ask responses contain the hostnames.
When cluster-announce-hostname is set, cluster nodes outputs the hostname along with the Ip. https://redis.io/docs/latest/commands/cluster-nodes/

cluster nodes output:

07c37dfeb235213a872192d90877d0cd55635b91 127.0.0.1:30004@31004,hostname4 slave e7d1eecce10fd6bb5eb35b9f99a514335d9ba9ca 0 1426238317239 4 connected

Problem:

When the nodes in the cluster have announced hostnames. StackExchange.Redis should parse the hostnames instead of IPs from cluster nodes output and connect to the nodes via hostnames.
By default, StackExchange.Redis runs cluster nodes and uses the IPs to make connections to the individual nodes. This integration will not work when the nodes are behind a proxy/NAT gateway, thus, we are expecting that when cluster-preferred-endpoint-type is set to hostname, on moving and connecting to a different node StackExchange.Redis will use hostname instead of IP.

Solution:

Suggesting StackExchange.Redis to make connections via hostnames if available and default to IPs if not present

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

No files or tests are named. Start by locating the cluster-nodes response parser and the code that handles MOVED and ASK responses, then trace how individual node endpoints are selected. Done means announced hostnames are used when available and IP addresses remain the fallback, with coverage for both endpoint forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, redis
Domain
databases, distributed-systems
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.