docker+Consul 部署

version: ‘3’
services:
consul-server1:
image: consul:latest
hostname: “consul-server1”
ports:
- “8500:8500”

  • “53”
    volumes:
    • ./consul/data1:/consul/data
      command: “agent -server -bootstrap-expect 3 -ui -disable-host-node-id -client 0.0.0.0”
      consul-server2:
      image: consul:latest
      hostname: “consul-server2”
      ports:
    • “8501:8500”
  • “53”
    volumes:
    • ./consul/data2:/consul/data
      command: “agent -server -ui -join consul-server1 -disable-host-node-id -client 0.0.0.0”
      depends_on:
    • consul-server1
      consul-server3:
      image: consul:latest
      hostname: “consul-server3”
      ports:
    • “8502:8500”
  • “53”
    volumes:
    • ./consul/data3:/consul/data
      command: “agent -server -ui -join consul-server1 -disable-host-node-id -client 0.0.0.0”
      depends_on:
    • consul-server1
      consul-node1:
      image: consul:latest
      hostname: “consul-node1”
      ports:
    • “8503:8500”
      volumes:
    • ./consul/node1:/consul/data
      command: “agent -ui -join consul-server1 -disable-host-node-id -server=false -client 0.0.0.0”
      depends_on:
    • consul-server1
      consul-node2:
      image: consul:latest
      hostname: “consul-node2”
      ports:
    • “8504:8500”
      volumes:
      • ./consul/node2:/consul/data
        command: “agent -ui -join consul-server1 -disable-host-node-id -server=false -client 0.0.0.0”
        depends_on:
    • consul-server1
本作品采用《CC 协议》,转载必须注明作者和本文链接
aruisi
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!