简体   繁体   中英

StackExchange Redis .NET client not getting messages when connections are reordered

Using the StackExchange.Redis client in a C# application, I am attempting to use PubSub to perform cross-server communication between web servers running the same application. In this model, each server is running its own Redis server, and its connection multiplexer sets the local server as the first server in the list. In other words, SERVER_A and SERVER_B each run a Redis server on port 6379 and have connection strings as follows:

SERVER_A --> "SERVER_A:6379,SERVER_B:6379"
SERVER_B --> "SERVER_B:6379,SERVER_A:6379"

Using external clients to subscribe to each Redis server, I can see SERVER_A publishing messages to its local Redis server. However, SERVER_B is not picking up the message, despite having a connection via the multiplexer. When I rearrange the order of the connections so they match, then messages from A are picked up by B. Is there something in a setting or otherwise that I need to do so that the connection multiplexer will listen to subscriptions on all servers, or is this a bug in the StackExchange.Redis client?

You don't mention any replication in your description. When SE.Redis connects to multiple servers it is intended to be a related family of servers - for example, either:

  • two or more 2.* servers related via master/slave
  • three or more 3.* servers related via a formal cluster

Replication groups have distribution mechanisms for pub/sub. Two disconnected servers: do not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM