StackExchange / StackExchange/StackExchange.Redis

Problems connecting to AWS MemoryDB cluster endpoint

Open
#2,013 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi,

We have an application that is using AWS MemoryDB. We have setup a cluster with one shard with two nodes. One of the nodes (named 0001-001) is a primary read/write while the other one is a read replica (named 0001-002).

After deploying the application, connecting to MemoryDB sometimes fails when we use the cluster endpoint connection string to connect. If we restart the application a few times it suddenly starts working. It seems to be random when it succeeds or not. The error we get is the following:

Endpoint Unspecified/ourapp-memorydb-cluster-0001-001.ourapp-memorydb-cluster.xxxxx.memorydb.eu-west-1.amazonaws.com:6379 serving hashslot 6024 is not reachable at this point of time. Please check connectTimeout value. If it is low, try increasing it to give the ConnectionMultiplexer a chance to recover from the network disconnect. IOCP: (Busy=0,Free=1000,Min=2,Max=1000), WORKER: (Busy=0,Free=32767,Min=2,Max=32767), Local-CPU: n/a

  • If we connect directly to the primary read/write node we get no such errors.
  • If we connect directly to the read replica it always fails. It even gets the error above, compaining about the "0001-001" node.
  • We use StackExchange.Redis 2.2.4

Configuration:

new ConfigurationOptions()
{
    EndPoints =
    {
        { "clustercfg.ourapp-memorydb-cluster.xxxxx.memorydb.eu-west-1.amazonaws.com", 6379 } // Cluster endpoint
    },
    User = "username",
    Password = "password",
    Ssl = true,
    AbortOnConnectFail = false,
    ConnectTimeout = 60000
};

We could "solve" it by directly connecting to the primary node, but if a failover occurs and 0001-002 becomes the primary node we would have to manually change our connectionstring.

Are we missing any configuration to be able to use the cluster endpoint connection string? Is this a known issue for MemoryDB?

Thanks // Rickard

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 with the reported ConfigurationOptions and StackExchange.Redis 2.2.4 cluster-endpoint behavior, then reproduce the connection using AWS MemoryDB with a primary and read replica. Trace how the client discovers and routes cluster nodes, including the reported hash-slot error; done means the endpoint behavior is understood and a verified fix or supported-configuration conclusion is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, csharp, redis
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.