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

   I tried to install consul, here are some steps:
   
   1. install 
   
   ```
   sudo yum install -y yum-utils
   sudo yum-config-manager --add-repo 
https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
   sudo yum -y install consul
   ```
   
   2. start consul
   
   ```
   consul agent -dev
   ```
   
   3. register service
   
   ```
   # register
   curl http://127.0.0.1:8500/v1/agent/service/register -X PUT -d '
   {
       "id":"pushgateway-9091",
       "name":"pushgateway",
       "address":"127.0.0.1",
       "port":9091,
       "check":{
           "http":"http://1.0.0.1:9091/-/healthy";,
           "interval":"10s",
           "timeout":"3s"
       }
   }'
   
   # check
   curl http://127.0.0.1:8500/v1/agent/service/pushgateway-9091
   {
       "ID": "pushgateway-9091",
       "Service": "pushgateway",
       "Tags": [],
       "Meta": {},
       "Port": 9091,
       "Address": "127.0.0.1",
       "TaggedAddresses": {
           "lan_ipv4": {
               "Address": "127.0.0.1",
               "Port": 9091
           },
           "wan_ipv4": {
               "Address": "127.0.0.1",
               "Port": 9091
           }
       },
       "Weights": {
           "Passing": 1,
           "Warning": 1
       },
       "EnableTagOverride": false,
       "ContentHash": "2f65415818755fba",
       "Datacenter": "dc1"
   }
   ```
   
   4. fetch service by dig
   
   ```
   dig @127.0.0.1 -p 8600 pushgateway.service.dc1.consul -t srv
   
   ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.8 <<>> @127.0.0.1 -p 8600 
pushgateway.service.dc1.consul -t srv
   ; (1 server found)
   ;; global options: +cmd
   ;; Got answer:
   ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 58617
   ;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
   ;; WARNING: recursion requested but not available
   
   ;; OPT PSEUDOSECTION:
   ; EDNS: version: 0, flags:; udp: 4096
   ;; QUESTION SECTION:
   ;pushgateway.service.dc1.consul.     IN      SRV
   
   ;; AUTHORITY SECTION:
   consul.                      0       IN      SOA     ns.consul. 
hostmaster.consul. 1656784437 3600 600 86400 0
   
   ;; Query time: 0 msec
   ;; SERVER: 127.0.0.1#8600(127.0.0.1)
   ;; WHEN: Sun Jul 03 01:53:57 CST 2022
   ;; MSG SIZE  rcvd: 109
   ```
   
   Here's how I should get to the service I just registered via dig, I tried a 
few ways by got no answer.


-- 
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