Golang的Redis库,用到最多的恐怕是
redigo 和 go-redis。其中 redigo 不支持对集群的访问。
在一个负载比较高的Redis Cluster中,如果允许对slave节点进行读操作将极大的提高集群的吞吐能力。
开启对Slave 节点的访问,受以下3个参数的影响
type ClusterOptions struct {
// Enables read-only commands on slave nodes.
ReadOnly bool
// Allows routing read-only commands to the closest master or slave node.
// It automatically enables ReadOnly.
RouteByLatency bool
// Allows routing read-only commands to the random master or slave node.
// It automatically enables ReadOnly.
RouteRandomly bool
…
}
如果ReadOnly = true,只选择Slave Node
如果ReadOnly = true 且 RouteByLatency = true 将从slot对应的Master Node 和 Slave Node选择,选择策略为: 选择PING 延迟最低的节点
如果ReadOnly = true 且 RouteRandomly = true 将从slot对应的Master Node 和 Slave Node选择,选择策略为:随机选择
http://vearne.cc/archives/1113
redis的订阅与发布功能
https://www.cnblogs.com/tangchuanyang/p/5985780.html