我在192.168.1.191上设置了Consul Master,在192.168.1.198设置了Agent。
我在Consul Master中尝试使用dig
命令,它可以工作:
# dig @192.168.1.191 -p 53 kafka.service.consul. ANY
; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> @192.168.1.191 -p 53 kafka.service.consul. ANY
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43471
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;kafka.service.consul. IN ANY
;; ANSWER SECTION:
kafka.service.consul. 0 IN A 192.168.1.86
;; Query time: 2 msec
;; SERVER: 192.168.1.191#53(192.168.1.191)
;; WHEN: Fri Dec 04 08:43:20 UTC 2015
;; MSG SIZE rcvd: 74
为什么呢?似乎Consul不能处理来自其他节点的请求。 任何帮助将不胜感激。
但是,当我在Consul Agent中尝试dig
命令时,我收到了一条超时消息:
# dig @192.168.1.191 -p 53 kafka.service.consul. ANY
; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> @192.168.1.191 -p 53 kafka.service.consul. ANY
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
以下是Consul Master上的TCPDump命令的输出:
# tcpdump -i eth1 udp port 53 -vv -X
tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes
08:35:42.282202 IP (tos 0x0, ttl 64, id 50130, offset 0, flags [none], proto UDP (17), length 77)
192.168.1.198.46137 > redis.domain: [udp sum ok] 48769+ [1au] ANY? kafka.service.consul. ar: . OPT UDPsize=4096 (49)
0x0000: 4500 004d c3d2 0000 4011 31f8 c0a8 01c6 E..M....@.1.....
0x0010: c0a8 01bf b439 0035 0039 6e55 be81 0120 .....9.5.9nU....
0x0020: 0001 0000 0000 0001 056b 6166 6b61 0773 .........kafka.s
0x0030: 6572 7669 6365 0663 6f6e 7375 6c00 00ff ervice.consul...
0x0040: 0001 0000 2910 0000 0000 0000 00 ....)........
08:35:47.284122 IP (tos 0x0, ttl 64, id 50899, offset 0, flags [none], proto UDP (17), length 77)
192.168.1.198.46137 > redis.domain: [udp sum ok] 48769+ [1au] ANY? kafka.service.consul. ar: . OPT UDPsize=4096 (49)
0x0000: 4500 004d c6d3 0000 4011 2ef7 c0a8 01c6 E..M....@.......
0x0010: c0a8 01bf b439 0035 0039 6e55 be81 0120 .....9.5.9nU....
0x0020: 0001 0000 0000 0001 056b 6166 6b61 0773 .........kafka.s
0x0030: 6572 7669 6365 0663 6f6e 7375 6c00 00ff ervice.consul...
0x0040: 0001 0000 2910 0000 0000 0000 00 ....)........
08:35:52.284451 IP (tos 0x0, ttl 64, id 51652, offset 0, flags [none], proto UDP (17), length 77)
192.168.1.198.46137 > redis.domain: [udp sum ok] 48769+ [1au] ANY? kafka.service.consul. ar: . OPT UDPsize=4096 (49)
0x0000: 4500 004d c9c4 0000 4011 2c06 c0a8 01c6 E..M....@.,.....
0x0010: c0a8 01bf b439 0035 0039 6e55 be81 0120 .....9.5.9nU....
0x0020: 0001 0000 0000 0001 056b 6166 6b61 0773 .........kafka.s
0x0030: 6572 7669 6365 0663 6f6e 7375 6c00 00ff ervice.consul...
0x0040: 0001 0000 2910 0000 0000 0000 00 ....)........