[更新]:当前redis将每个已发布的消息发送到整个集群中的每个节点:
  
  /* -----------------------------------------------------------------------------
 * CLUSTER Pub/Sub support
 *
 * For now we do very little, just propagating PUBLISH messages across the whole
 * cluster. In the future we'll try to get smarter and avoiding propagating those
 * messages to hosts without receives for a given channel.
 * -------------------------------------------------------------------------- */
void clusterPropagatePublish(robj *channel, robj *message) {
    clusterSendPublish(NULL, channel, message);
}
  
   这是问题的原文,不正确:
  
  
   
    据我所知,我需要:
   
   
    - 
     
      给定一个通道,找到拥有散列槽的节点。
     
     
    - 
     
      订阅该节点和cluster:slots以检测迁移。
     
     
    - 
     
      在插槽迁移时,订阅新节点上的通道并保持旧连接打开。
     
     
    - 
     
      将消息从旧连接转发到应用程序,直到它关闭并记住这些消息。
     
     
    - 
     
      当迁移完成并且旧连接关闭时,从新连接转发消息,修剪记住的消息
从第一个连接开始。
     
     
   
   
    golang redis客户端库中有没有这样做?我查过了
很多人觉得我需要自己不断地写这个逻辑
轮询
    
     CLUSTER SLOTS
    
    或者听一个公开的信息
当碎片增加或减少并移动我现有的pubsub时
从一个服务器到另一个服务器的脚本。
   
   
    也就是说,有很多golang libs处理普通的get key和cluster
即使碎片的数量改变了。但是pubsub和cluster是
其他的事情对吗?