Skip to content

subscribe to redis cluster #2846

Open
@anton-burtsev

Description

@anton-burtsev

I deployed redis cluster with following command

helm install my-release oci://registry-1.docker.io/bitnamicharts/redis-cluster

helm created 6 nodes: 3 masters and 3 slaves

I activated notifications on EACH pod

D:\src\red>kubectl exec -ti my-red-redis-cluster-1 -- /bin/bash
I have no name!@my-red-redis-cluster-1:/$ redis-cli config set notify-keyspace-events AKEnm
OK

Then I try to subscribe to key updates. For each i in 0..5 I did

    var redis = await ConnectionMultiplexer.ConnectAsync(
        $"my-red-redis-cluster-{i}.my-red-redis-cluster-headless.default.svc.cluster.local:6379,password={password}");
    var sub = redis.GetSubscriber();
    var channel = new RedisChannel("__key*@*__:*", RedisChannel.PatternMode.Pattern);
    await sub.SubscribeAsync(channel, Accept);
    Console.WriteLine($"Subscribed to channel {i} - {sub.SubscribedEndpoint(channel)}");

I see it connects to the same server for any "i" value

Subscribed to channel 4 - 10.1.37.157:6379
Subscribed to channel 0 - 10.1.37.157:6379
Subscribed to channel 2 - 10.1.37.157:6379
Subscribed to channel 3 - 10.1.37.157:6379
Subscribed to channel 5 - 10.1.37.157:6379
Subscribed to channel 1 - 10.1.37.157:6379

And then I receive only ~ 33% of notifications.

if I subscribe using redis-cli on each server - I receive all notifications too.

What should I do to receive all notifications in C# program?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions