Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.4k views
in Technique[技术] by (71.8m points)

redis cluster连接问题

最近在学redis, 有个疑问? 假如3主3从的redis分布式集群, 程序连接哪一个redis主实例(3个)? 假设连接 a机器ip:6379 , 如果它宕机了切换到 b的6379 怎么办? 望各位请教...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

严格意义上reids是没有主从的,
并且redis集群的连接方式与单机连接方式不同,集群连接需要将所有节点的ip写入到配置文件中,客户端连接任意一个节点后由集群内部做分发连接到当前选举的主节点上.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...