快速组建 Nats 集群
NATS 是个开源、轻量级、高性能的云原生消息系统,实现了具有高度伸缩性的、优雅的发布-订阅(pub/sub)分布式模型。天生具备的高性能,使其成为构建现代、可靠、易伸缩的云原生分布式系统的理想基础。 模拟 3 节点集群,创建 docker-compose.yml version: "3" services: nats1: image: nats:alpine restart: always command: "-c /etc/node.conf" volumes: - ./etc/node-1.conf:/etc/node.conf ports: - 4222:4222 nats2: image: nats:alpine restart: always command: "-c /etc/node.conf" volumes: - ./etc/node-2.conf:/etc/node.conf ports: - 4223:4222 nats3: image: nats:alpine restart: always command: "-c /etc/node.conf" volumes: - ./etc/node-3.conf:/etc/node.conf ports: - 4224:4222 其中节点配置分别为 # node-1.conf port: 4222 cluster { listen: "0.0.0.0:6222" routes = [ nats://nats2:6222 nats://nats3:6222 ] } # node-2.conf port: 4222 cluster { listen: "0....