linux下
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
window下
https://developer.hashicorp.com/consul/downloads
?
然后把里面的exe文件放在gopath下就行了
驗證[終端輸入consul即可]

consul啟動單節點
consul agent -server -dev -ui -client 127.0.0.1//然后瀏覽器輸入http://127.0.0.1:8500/ui/dc1/services
防火墻打開指定端口
sudo firewall-cmd --add-port=8301/tcp --permanent//重載
sudo firewall-cmd --reload
//查看
sudo firewall-cmd --list-all
consul啟動集群命令
//(作為集群ip) consul agent -server -bootstrap-expect 3 -node=s1 -bind=192.168.1.103 -ui -rejoin -client 0.0.0.0 -join 192.168.1.103 -data-dir /tmp/consul //(作為server) consul agent -server -bootstrap-expect 3 -node=s1 -bind=192.168.80.129 -ui -rejoin -client 0.0.0.0 -join 192.168.1.103 -data-dir /tmp/consul? -bootstrap-expect=5: 指定了集群有5臺 ? -node=agent-x: 指定服務器 ? -client=0.0.0.0: 指定當前主機客戶端偵聽地址為0.0.0.0 ? -bind: 綁定當前主機的ip地址 ? -datacenter=dc: 指定了一個數據中心的名稱 ? -join 192.168.180.130: 后幾臺服務器在啟動的時候加入第一臺代理服務器node01(PS, 比較坑的是即使已經改過hostname文件, 還是得敲ip) ? -ui指定了啟用每臺服務器的內置 WebUI 服務器組件 ? 當五臺服務器都正確運行起來以后,Consul 集群將自動選舉 leader,自動進行集群事務,無需干預。
查看集群中成員
consul members