sudo apt-get update && sudo apt-get install consul
## 验证安装的结果 root@ubuntu18-119:/etc/consul.d# cd root@ubuntu18-119:~# consul version Consul v1.9.5 Revision 3c1c22679 Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
配置文件
在开始配置文件之前,先要生成一个秘钥。 随便在三台中的任意一台机器运行以下命令
1 2 3 4
root@ubuntu18-121:~# consul keygen byCHv8NFR6p770xmNNjxlCGdeH9e0YU7CwZFnsnOW8w=
## --------------------------- ## Check cluster members root@ubuntu18-119:~# consul members Node Address Status Type Build Protocol DC Segment ubuntu18-119 192.168.1.119:8301 alive server 1.9.5 2 feiyang <all> ubuntu18-120 192.168.1.120:8301 alive server 1.9.5 2 feiyang <all> ubuntu18-121 192.168.1.121:8301 alive server 1.9.5 2 feiyang <all>