You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that the subscriber always subscribes to one of the nodes (in my case "10.0.255.86:6379") and I guess it's because the Redis will broadcast each published message to all other nodes:
"The clients can send SUBSCRIBE to any node and can also send PUBLISH to any node. It will simply broadcast each published message to all other nodes."
It works as described if the message is indeed published by a client, but won't work the same way when it comes to internal messages published by the node itself, when a change occurs. For some reason only the node that owns the key/value entity will receive it. I don't know if that's a bug in Redis or it works this way by design but I tried to workaround it. I created a separate ConnectionMultiplexer connecting it to a single node. However, all the multiplexers always subscribe to "10.0.255.86:6379" including those that are connected to "10.0.255.87:6379" or "10.0.255.88:6379" and receive change notifications that happen on that node. I guess the ConnectionMultiplexer gets the whole list of nodes after connects and always subscribes for the first one.
So, if I'm not doing anything wrong, then I assume there is no way to control to which node to subscribe and respectively there is no way to receive Redis keyspace notifications from all the nodes using StackExchange.Redis.
The text was updated successfully, but these errors were encountered:
orlinhristov
changed the title
The Subsscribe subscribes to one node only when having Redis cluster
The Subscribe method subscribes to one node only when having Redis cluster
Jun 27, 2024
I'm trying to write a straightforward .Net app that will subscribe to a cluster of Redis nodes, to receive change notifications.
I see that the subscriber always subscribes to one of the nodes (in my case
"10.0.255.86:6379"
) and I guess it's because the Redis will broadcast each published message to all other nodes:"The clients can send
SUBSCRIBE
to any node and can also sendPUBLISH
to any node. It will simply broadcast each published message to all other nodes."It works as described if the message is indeed published by a client, but won't work the same way when it comes to internal messages published by the node itself, when a change occurs. For some reason only the node that owns the key/value entity will receive it. I don't know if that's a bug in Redis or it works this way by design but I tried to workaround it. I created a separate ConnectionMultiplexer connecting it to a single node. However, all the multiplexers always subscribe to
"10.0.255.86:6379"
including those that are connected to"10.0.255.87:6379"
or"10.0.255.88:6379"
and receive change notifications that happen on that node. I guess the ConnectionMultiplexer gets the whole list of nodes after connects and always subscribes for the first one.So, if I'm not doing anything wrong, then I assume there is no way to control to which node to subscribe and respectively there is no way to receive Redis keyspace notifications from all the nodes using StackExchange.Redis.
The text was updated successfully, but these errors were encountered: