From 071bad218a52375a50f0558ff59559b5a33a8a75 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Wed, 14 Sep 2016 10:41:38 -0400 Subject: [PATCH] Document Eureka client zone config. Fixes #31327 --- .../main/asciidoc/spring-cloud-netflix.adoc | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/src/main/asciidoc/spring-cloud-netflix.adoc b/docs/src/main/asciidoc/spring-cloud-netflix.adoc index 044a3404..b4a02a8a 100644 --- a/docs/src/main/asciidoc/spring-cloud-netflix.adoc +++ b/docs/src/main/asciidoc/spring-cloud-netflix.adoc @@ -305,6 +305,33 @@ production it's probably better to stick with the default because there are some computations internally in the server that make assumptions about the lease renewal period. + +=== Zones + +If you have deployed Eureka clients to multiple zones than you may prefer that +those clients leverage services within the same zone before trying services +in another zone. To do this you need to configure your Eureka clients correctly. + +First, you need to make sure you have Eureka servers deployed to each zone and that +they are peers of each other. See the section on <> +for more information. + +Next you need to tell Eureka which zone your service is in. You can do this using +the `metadataMap` property. For example if `service 1` is deployed to both `zone 1` +and `zone 2` you would need to set the following Eureka properties in `service 1` + +*Service 1 in Zone 1* +``` +eureka.instance.metadataMap.zone = zone1 +eureka.client.preferSameZoneEureka = true +``` + +*Service 1 in Zone 2* +``` +eureka.instance.metadataMap.zone = zone2 +eureka.client.preferSameZoneEureka = true +``` + [[spring-cloud-eureka-server]] == Service Discovery: Eureka Server @@ -362,6 +389,7 @@ dependencyManagement { ---- ==== +[[spring-cloud-eureka-server-zones-and-regions]] === High Availability, Zones and Regions The Eureka server does not have a backend store, but the service