官網上下載consul,下載地址是https://www.consul.io/downloads.html,根據不一樣操做系統選中不一樣的版本。html
List-1java
xx@xx-ubuntu:/opt/software/tool$ ll total 130916 -rwxr-xr-x 1 mjduan mjduan 99396904 11月 15 06:42 consul* -rw-rw-r-- 1 mjduan mjduan 34591598 12月 16 19:47 consul_1.4.0_linux_amd64.zip
List-2linux
xx@xx-ubuntu:/opt/software/tool$ ./consul agent -dev ==> Starting Consul agent... ==> Consul agent running! Version: 'v1.4.0' Node ID: '47a39e6c-656a-0198-c9ab-5e036ec416b7' Node name: 'xx-ubuntu' Datacenter: 'dc1' (Segment: '<all>') Server: true (Bootstrap: false) Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: -1, gRPC: 8502, DNS: 8600) Cluster Addr: 127.0.0.1 (LAN: 8301, WAN: 8302) Encrypt: Gossip: false, TLS-Outgoing: false, TLS-Incoming: false ==> Log data will now stream in as it occurs:
List-3ubuntu
xx@xx-ubuntu:/opt/software/tool$ ./consul members Node Address Status Type Build Protocol DC Segment xx-ubuntu 127.0.0.1:8301 alive server 1.4.0 2 dc1 <all>
在瀏覽器中輸入http://localhost:8500瀏覽器
圖5.1 consul管理界面bash
注意,關閉服務時,直接ctrl+c便可。flex
注意,上面描述並不是集羣模式,只適合在開發環境中使用。ui
consul與euraka相似,也用於服務註冊與發現,很惋惜netflex再也不維護euraka了。spa