spring-cloud-consul icon indicating copy to clipboard operation
spring-cloud-consul copied to clipboard

ConsulServerList to support multiple data center

Open ezraroi opened this issue 8 years ago • 5 comments

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 in ConsulServerList to first query for all data centers and after it query each data center for the healthy services.

ezraroi avatar Jul 05 '17 09:07 ezraroi

also looks like when using consul, the ZonePreferenceServerListFilter should be used and not the HealthServiceServerListFilter

ezraroi avatar Jul 06 '17 04:07 ezraroi

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 avatar Jun 16 '19 02:06 varnson

@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 avatar Jun 16 '19 18:06 ezraroi

@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 avatar Jun 17 '19 13:06 varnson

@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

ezraroi avatar Jun 17 '19 17:06 ezraroi