下载binary consul
wget https://releases.hashicorp.com/consul/1.2.2/consul_1.2.2_linux_amd64.zip unzip consul_1.2.2_linux_amd64.zip mv consul /usr/bin/
验证
# consul -v Consul v1.2.2 Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents
启动
nohup consul agent -server -bootstrap -ui -data-dir /var/lib/consul -client=10.16.32.111 -bind=10.16.32.111 &>/var/log/consul.log &
查看日志
[root@lucien ~]# tail -f /var/log/consul.log 2018/08/22 17:28:05 [INFO] agent: started state syncer 2018/08/22 17:28:12 [ERR] agent: failed to sync remote state: No cluster leader 2018/08/22 17:28:13 [WARN] raft: Heartbeat timeout from "" reached, starting election 2018/08/22 17:28:13 [INFO] raft: Node at 10.16.32.111:8300 [Candidate] entering Candidate state in term 2 2018/08/22 17:28:13 [INFO] raft: Election won. Tally: 1 2018/08/22 17:28:13 [INFO] raft: Node at 10.16.32.111:8300 [Leader] entering Leader state 2018/08/22 17:28:13 [INFO] consul: cluster leadership acquired 2018/08/22 17:28:13 [INFO] consul: New leader elected: lucien 2018/08/22 17:28:13 [INFO] consul: member 'lucien' joined, marking health alive 2018/08/22 17:28:15 [INFO] agent: Synced node info