/* ----------------------------------------------------------------------------- * 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);}
这是问题的原始文本,这是不正确的:
解决方法 Redis集群中的PubSub通道在所有节点之间共享 – 消息通过内部总线传递,因此您不需要特殊的客户端和/或逻辑.As I understand it I need to:
Given a channel,find the the node that owns the hash slot.
Subscribe to that node and also to cluster:slots to detect migrations.
Upon slot migration,subscribe to the channel on the new node and keep the old connection open.
Forward messages to the application from the old connection until it closes and remember those messages.
When migration is complete and the old connection closed,forward messages from the new connection,trimming the remembered messages
from the first connection.Do any of the golang redis clIEnt library do this? I’ve looked through
many and it feels like I need to write this logic myself,constantly
pollingCLUSTER SLOTS
or Listening to a pubsub of that info to kNow
when shards increase or decrease and move my existing pubsub
scriptions from one server to another.I.e. there lots of golang libs that handle normal GET key with cluster
even if the number of shards changes. But pubsub and cluster is a
whole other thing right?
In a Redis Cluster clIEnts can subscribe to every node,and can also publish to every other node. The cluster will make sure that published messages are forwarded as needed.
资料来源:Redis Cluster Specification
总结以上是内存溢出为你收集整理的是否有一个golang redis客户端可以自动检测pubsub的新分片?全部内容,希望文章能够帮你解决是否有一个golang redis客户端可以自动检测pubsub的新分片?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)