Consul 基础6

2021-12-01 17:09:53 浏览数 (1)

使用 dig 查看节点IP

代码语言:javascript复制
[root@h104 ~]# dig @127.0.0.1 -p 8600  h104.node.consul

; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.1 <<>> @127.0.0.1 -p 8600 h104.node.consul
; (1 server found)
;; global options:  cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43696
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;h104.node.consul.		IN	A

;; ANSWER SECTION:
h104.node.consul.	0	IN	A	192.168.100.104

;; Query time: 1 msec
;; SERVER: 127.0.0.1#8600(127.0.0.1)
;; WHEN: Fri Mar 18 17:22:33 CST 2016
;; MSG SIZE  rcvd: 66

[root@h104 ~]# 

停止服务

终端前台运行的情况下 Ctrl-C 可以平滑地停止服务

代码语言:javascript复制
...
...
...
    2016/03/18 16:41:30 [DEBUG] agent: Service 'consul' in sync
    2016/03/18 16:43:12 [DEBUG] agent: Service 'consul' in sync
    2016/03/18 16:44:22 [DEBUG] agent: Service 'consul' in sync
    2016/03/18 16:45:46 [DEBUG] agent: Service 'consul' in sync
^C==> Caught signal: interrupt
==> Gracefully shutting down agent...
    2016/03/18 16:46:58 [INFO] consul: server starting leave
    2016/03/18 16:46:58 [INFO] serf: EventMemberLeave: h104.dc1 192.168.100.104
    2016/03/18 16:46:58 [INFO] serf: EventMemberLeave: h104 192.168.100.104
    2016/03/18 16:46:58 [DEBUG] http: Shutting down http server (127.0.0.1:8500)
    2016/03/18 16:46:58 [INFO] agent: requesting shutdown
    2016/03/18 16:46:58 [INFO] consul: shutting down server
    2016/03/18 16:46:58 [ERR] dns: error starting tcp server: accept tcp 127.0.0.1:8600: use of closed network connection
    2016/03/18 16:46:58 [INFO] agent: shutdown complete
[root@h104 consul]#
[root@h104 consul]# consul members 
Error connecting to Consul agent: dial tcp 127.0.0.1:8400: getsockopt: connection refused
[root@h104 consul]# netstat  -tunpea | grep consul
[root@h104 consul]#

0 人点赞