You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/06 02:06:29 UTC

[GitHub] [apisix] fuguanye opened a new issue #4986: Set discovery to DNS, and the service port cannot be obtained automatically

fuguanye opened a new issue #4986:
URL: https://github.com/apache/apisix/issues/4986


   ### Issue description
   
   服务发现使用为DNS后,添加路由时,服务名称一定要带端口号吗,测试发现不带端口都被转发到80端口上去了
   config.yaml:
   discovery:
     dns:
       servers:
         - "127.0.0.1:8600"          # use the real address of your dns server
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   {
       "uri": "/gatewayd/*",
       "upstream": {
           "service_name": "gateway.service.consul"
           "type": "roundrobin",
           "discovery_type": "dns"
       },
    "plugins": {
           "proxy-rewrite" : {
               "regex_uri": ["^/gatewayd/(.*)", "/${1}"]
           }
       }
   }'
   
   ![G}54OW9QEESI L5M}1H`G05](https://user-images.githubusercontent.com/48759779/132150102-f7d42f14-dbe7-4155-a3f5-2aa340551723.jpg)
   ![@9%8JW L44 @V{B(6V7 BNU](https://user-images.githubusercontent.com/48759779/132150150-a09e8e6e-32a6-4ea9-8f30-b8b22a7e9a20.jpg)
   而实际环境中一个服务对应多个节点,端口都是随机不一致的
   不能自动获取consul 上注册上去的端口么
   
   ### Environment
   
   - apisix version (cmd: `apisix version`): 2.9
   - OS (cmd: `uname -a`): cenos 7 Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):openresty/1.19.9.1
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):3.5.0
   - apisix-dashboard version, if have:2.7
   - concul version :V1.10.2
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fuguanye commented on issue #4986: Set discovery to DNS, and the service port cannot be obtained automatically

Posted by GitBox <gi...@apache.org>.
fuguanye commented on issue #4986:
URL: https://github.com/apache/apisix/issues/4986#issuecomment-913317312


   > 输出内容:
   > 
   > ```
   > dig @your_consul_ip gateway.service.consul
   > dig @your_consul_ip gateway.service.consul SRV
   > dig @your_consul_ip gateway.service.consul A
   > ```
   > 
   > 在你的环境中?
   
   ![image](https://user-images.githubusercontent.com/48759779/132158370-93b8229e-d876-472b-9a57-246707b0a56a.png)
   ![image](https://user-images.githubusercontent.com/48759779/132158420-0c241ea5-d830-464e-9562-8529e3a4dc71.png)
   ![image](https://user-images.githubusercontent.com/48759779/132158435-35cff010-cad8-41c6-b976-28d584d2b994.png)
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander closed issue #4986: Set discovery to DNS, and the service port cannot be obtained automatically

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #4986:
URL: https://github.com/apache/apisix/issues/4986


   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fuguanye commented on issue #4986: Set discovery to DNS, and the service port cannot be obtained automatically

Posted by GitBox <gi...@apache.org>.
fuguanye commented on issue #4986:
URL: https://github.com/apache/apisix/issues/4986#issuecomment-913595945


   按照合并的代码修改后,已经OK了,多谢


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] spacewander commented on issue #4986: Set discovery to DNS, and the service port cannot be obtained automatically

Posted by GitBox <gi...@apache.org>.
spacewander commented on issue #4986:
URL: https://github.com/apache/apisix/issues/4986#issuecomment-913313767


   What's the output of:
   ```
   dig @your_consul_ip gateway.service.consul
   dig @your_consul_ip gateway.service.consul SRV
   dig @your_consul_ip gateway.service.consul A
   ```
   in your environment?


-- 
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-unsubscribe@apisix.apache.org

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