# dockerConsul集群搭建

# 1、安装consul

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install consul

# 2、启动

```
172.18.15.8启动consul
consul agent -server -bootstrap-expect=2 -data-dir=/tmp/consul -node=172.18.15.8 -bind=172.18.15.8 -client=0.0.0.0 -datacenter=shenzhen -ui
172.18.15.10启动consul
consul agent -server -bootstrap-expect=2 -data-dir /tmp/consul -node 172.18.15.10 -bind=172.18.15.10 -client=0.0.0.0 -datacenter shenzhen -ui

consul agent -server -bootstrap-expect=3 -data-dir=/data0/tmp/consul -node=172.18.15.11 -bind=172.18.15.11 -client=0.0.0.0 -datacenter=guangzhou -ui

 /usr/local/bin/docker-compose --compatibility up -d --remove-orphans

```

# 3、加入节点

172.18.15.8
consul join 172.18.15.10
Last Updated: 8/16/2021, 9:12:25 AM