获取镜像
docker pull consul
运行Consul镜像
docker run --name consul -d -p 8500:8500 -p 8600:8600/udp consul
-- udp 解析域名对应的ip,从下面结果看通过域名也能直接访问
192:~ dailong$ dig @127.0.0.1 -p 8600 Consul-service.service.consul
; <<>> DiG 9.10.6 <<>> @127.0.0.1 -p 8600 Consul-service.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6442
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;Consul-service.service.consul. IN A
;; ANSWER SECTION:
Consul-service.service.consul. 0 IN A 192.168.1.75
;; Query time: 5 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Mon Apr 20 11:20:04 CST 2020
;; MSG SIZE rcvd: 74
ui界面查看节点信息
-
其中健康检查主要是调用boot的/actuator/health获取的数据