StackExchange / StackExchange/StackExchange.Redis

Force to resolve dns host on reconnect

Open
#1,015 1 comment 8 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

I have a scenario where I'm running a redis instance on a cluster with dns service discovery.
The cluster manager will sometimes relocate the redis instance to another node. Using the option resolveDNS on the client, I see that once the dns is resolved, the returned ip is cached. It also seems that the dns resolve routine is called only once of first connect, server endpoints are then cached and their ips are used on subsequent reconnections. It would be useful on my scenario to make the client resolve the dns host again on a reconnect attempt.

My current workaround is to connect to a load balancer host, which monitors nodes for redis existence. This is a sub optimal solution since the load balancer has a minimum health check period.
Another workaround is to setup a tcp proxy on every node that will resolve the redis location. Again a sub optimal solution that leads to an extra hop.

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 tracing the client's resolveDNS handling and reconnect path to confirm where the resolved server endpoint is cached. The change is complete when a reconnect attempt resolves the DNS host again instead of reusing the previously resolved IP; the issue names no files or tests, so the relevant coverage must be located in the repository.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, redis
Domain
backend, 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.