ElonMusk.doDocker中配置Redis clusters集群,很多人直接上手配不好,我直接给答案了 中发帖

1.Redis cluster除了当前默认的6379端口,还会在这端口的基础上+10000开个总线(bus)端口16379,bus是控制集群之间的通信通道,搭建clusters必不可少
2.在docker-compose中映射出去后,需要配置–cluster-announce相关参数告知本地的集群,不然即使在create过程host.docker.internal:6380能找到相应主机,但该主机内部会以为自己是localhost:6379最后导致错误
了解这两点,就很容易实现Docker中的Redis集群搭建了
docker-compose.yml
services:
redis0:
image: redis:latest
ports:
- "6380:6379"
- "16380:16379"
command: >
...