Open ezraroi opened 7 years ago
also looks like when using consul, the ZonePreferenceServerListFilter
should be used and not the HealthServiceServerListFilter
Consul supports multiple data centers to share data, but is different with eureka. So I don't think it's a good idea to use consul in the eureka way. Consul has it's own query interface(/v1/query/) to get data from another data center.
@varnson This is not true. Consul also support service discovery via multiple data center. This is how we use it. We implemented a MultizoneDatacenterServerList.
@ezraroi Yes, consul support service discovery via multiple data center. And consul has a query interface to query services between data centers. https://www.consul.io/api/query.html So I think there is no need to use MultizoneDatacenterServerList.
@varnson by having it as a server list filter we create ribbon clients that sends requests to different data center of a service doesn't exists in the current data center
Currently, when using consul and ribbon (ZoneAwareLoadBalancer), multiple data centers are not supported so it is not really zone aware.
Looks like a simple change in the
getServers
method inConsulServerList
to first query for all data centers and after it query each data center for the healthy services.