docker-compose启动consul集群

Posted dongbo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker-compose启动consul集群相关的知识,希望对你有一定的参考价值。

version: ‘2.0‘
services:
  consul-server1:
    image: consul:latest
    hostname: "consul-server1"
    ports:
      - "8501:8500"
    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:
      - "8502:8500"
    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:
      - "8503:8500"
    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"
    command: "agent -join consul-server1 -disable-host-node-id"
    depends_on:
      - consul-server1
  consul-node2:
    image: consul:latest
    hostname: "consul-node2"
    command: "agent -join consul-server1 -disable-host-node-id"
    depends_on:
      - consul-server1

 

以上是关于docker-compose启动consul集群的主要内容,如果未能解决你的问题,请参考以下文章

使用Docker-compose搭建consul集群环境

使用Docker-Compose搭建consul集群环境!!!

使用Docker-Compose搭建consul集群环境!!!

使用Docker-Compose搭建consul集群环境!!!

docker基础之docker-compose搭建consul集群

docker基础之docker-compose搭建consul集群