hi:

I am not familiar with consul, but it seems that we should use `
/catalog/services`.

ANSWER 1:
https://stackoverflow.com/questions/44240633/single-api-to-list-all-the-services-consul-cluster

I advise to submit a question to the `consul` project:
https://github.com/hashicorp/consul

I think they can tell us which way is best.


On Sat, Jan 7, 2023 at 12:23 AM 李 奕浩 <yihao.li...@hotmail.com> wrote:

> Hi, community,
>
> I wanted to talk to you about the optimization of the Consul discovery.
>
> WHAT
>
> Currently, the Consul discovery plugin can dump all services info in
> APISIX, Specific usage reference:
>
>
> https://github.com/apache/apisix/blob/master/docs/en/latest/discovery/consul.md
>
> In Consul discovery Lua code, the Consul discovery plugin used
> /catalog/services to check update and /agent/services to get all services
> info. for some situation, it can not get all services info from this
> /agent/services, reference reading:
> https://developer.hashicorp.com/consul/api-docs/agent/service
>
> The /agent/service endpoints interact with services on the local agent in
> Consul. These should not be confused with services in the catalog.
>
> WHY
>
>   1.  Optimize Consul discovery plugin to make the APISIX more robust
>
>   2.  Obtain the services info form Consul to be more precise
>
> HOW
>
>   1.  Obtain all services with /catalog/services, reference: Consul List
> Services<
> https://developer.hashicorp.com/consul/api-docs/catalog#list-services>
>
>   2.  Obtain nodes for each service with /catalog/service/:service,
> reference: Consul List Nodes for Service<
> https://developer.hashicorp.com/consul/api-docs/catalog#list-nodes-for-service
> >
>
>   3.  Save this service node info in local variable
>
> Best Regard
>
> Yihao LI
>
> My GitHub: https://github.com/Fabriceli
>


-- 

*MembPhis*
My GitHub: https://github.com/membphis
Apache APISIX: https://github.com/apache/apisix

Reply via email to