Skip to content

subscribe to redis cluster #2846

Closed
Closed

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?

Activity

  1. mgravell commented on Feb 4, 2025

    @mgravell
    Collaborator
  2. mgravell commented on Jul 22, 2026

    @mgravell
    Collaborator

    Implemented in StackExchange.Redis 2.11.0 (#2995): full cluster keyspace/keyevent delivery via RedisChannelOptions.MultiNode + RedisChannel.KeySpace/KeyEvent (see docs/KeyspaceNotifications.md). Same feature as #2750. Closing as completed.

    Note: requires the new multi-node channel API rather than a raw __key*@*__:* pattern subscribe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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