tzssangglass commented on issue #6694:
URL: https://github.com/apache/apisix/issues/6694#issuecomment-1173316698

   > Which version of consul did you use in this case? 
   
   consul version
   Consul v1.12.2
   Revision 19041f20
   
   > And when you dug the DNS search repeated, did consul return random `;; 
ANSWER SECTION:` result?
   
   no,  maybe because I didn't add the `check` configuration.
   
   > In addition, I recommend that you may try the test case again after the 
discovery refreshes the DNS search result.
   
   OK, I change step 2 preparing the consul DNS configuration, the consul DNS 
configs like
   
   ```
   $ cat consul.d/mock-2980.json
   {
   "service": {
       "id": "mock-2980",
       "name": "openresty",
       "address": "127.0.0.1",
       "port": 2980,
       "check": {
         "http": "http://127.0.0.1:2980/healthy";,
         "interval": "3s",
         "timeout": "1s"
       }
     }
   }
   
   $ cat consul.d/mock-2981.json
   {
   "service": {
       "id": "mock-2981",
       "name": "openresty",
       "address": "127.0.0.1",
       "port": 2981,
       "check": {
         "http": "http://127.0.0.1:2981/healthy";,
         "interval": "3s",
         "timeout": "1s"
       }
     }
   }
   
   $ cat consul.d/mock-2982.json
   {
   "service": {
       "id": "mock-2982",
       "name": "openresty",
       "address": "127.0.0.1",
       "port": 2982,
       "check": {
         "http": "http://127.0.0.1:2982/healthy";,
         "interval": "3s",
         "timeout": "1s"
       }
     }
   }
   ```
   
   and dig return random `ANSWER SECTION` result(order change), like:
   
   ```
   $ dig @127.0.0.1 -p 8600 openresty.service.consul -t srv
   
   ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.8 <<>> @127.0.0.1 -p 8600 
openresty.service.consul -t srv
   ; (1 server found)
   ;; global options: +cmd
   ;; Got answer:
   ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7328
   ;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 7
   ;; WARNING: recursion requested but not available
   
   ;; OPT PSEUDOSECTION:
   ; EDNS: version: 0, flags:; udp: 4096
   ;; QUESTION SECTION:
   ;openresty.service.consul.   IN      SRV
   
   ;; ANSWER SECTION:
   openresty.service.consul. 0  IN      SRV     1 1 2982 
7f000001.addr.dc1.consul.
   openresty.service.consul. 0  IN      SRV     1 1 2980 
7f000001.addr.dc1.consul.
   openresty.service.consul. 0  IN      SRV     1 1 2981 
7f000001.addr.dc1.consul.
   
   ;; ADDITIONAL SECTION:
   7f000001.addr.dc1.consul. 0  IN      A       127.0.0.1
   machine.node.dc1.consul. 0   IN      TXT     "consul-network-segment="
   7f000001.addr.dc1.consul. 0  IN      A       127.0.0.1
   machine.node.dc1.consul. 0   IN      TXT     "consul-network-segment="
   7f000001.addr.dc1.consul. 0  IN      A       127.0.0.1
   machine.node.dc1.consul. 0   IN      TXT     "consul-network-segment="
   
   ;; Query time: 0 msec
   ;; SERVER: 127.0.0.1#8600(127.0.0.1)
   ;; WHEN: Mon Jul 04 12:02:18 CST 2022
   ;; MSG SIZE  rcvd: 354
   
   $ dig @127.0.0.1 -p 8600 openresty.service.consul -t srv
   
   ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.8 <<>> @127.0.0.1 -p 8600 
openresty.service.consul -t srv
   ; (1 server found)
   ;; global options: +cmd
   ;; Got answer:
   ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38061
   ;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 7
   ;; WARNING: recursion requested but not available
   
   ;; OPT PSEUDOSECTION:
   ; EDNS: version: 0, flags:; udp: 4096
   ;; QUESTION SECTION:
   ;openresty.service.consul.   IN      SRV
   
   ;; ANSWER SECTION:
   openresty.service.consul. 0  IN      SRV     1 1 2981 
7f000001.addr.dc1.consul.
   openresty.service.consul. 0  IN      SRV     1 1 2980 
7f000001.addr.dc1.consul.
   openresty.service.consul. 0  IN      SRV     1 1 2982 
7f000001.addr.dc1.consul.
   
   ;; ADDITIONAL SECTION:
   7f000001.addr.dc1.consul. 0  IN      A       127.0.0.1
   machine.node.dc1.consul. 0   IN      TXT     "consul-network-segment="
   7f000001.addr.dc1.consul. 0  IN      A       127.0.0.1
   machine.node.dc1.consul. 0   IN      TXT     "consul-network-segment="
   7f000001.addr.dc1.consul. 0  IN      A       127.0.0.1
   machine.node.dc1.consul. 0   IN      TXT     "consul-network-segment="
   
   ;; Query time: 0 msec
   ;; SERVER: 127.0.0.1#8600(127.0.0.1)
   ;; WHEN: Mon Jul 04 12:02:20 CST 2022
   ;; MSG SIZE  rcvd: 354
   
   ```
   
   then I repeated step 4 at different times, like:
   
   ```
   $ curl http://127.0.0.1:9080/echo -H "Host: fatpa.me"
   2982
   
   $ curl http://127.0.0.1:9080/echo -H "Host: fatpa.me"
   2982
   
   $ curl http://127.0.0.1:9080/echo -H "Host: fatpa.me"
   2982
   ```
   
   still no recurrence.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to