Skip to content
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

subscribe to redis cluster #2846

Open
anton-burtsev opened this issue Feb 4, 2025 · 1 comment
Open

subscribe to redis cluster #2846

anton-burtsev opened this issue Feb 4, 2025 · 1 comment

Comments

@anton-burtsev
Copy link

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?

@mgravell
Copy link
Collaborator

mgravell commented Feb 4, 2025 via email

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

No branches or pull requests

2 participants