Hi,
I have two Service discovery servers and I am trying to get the same zone preference to work. However I notice that the calls are just round robin'ing across the two zones. My expectation is that the calls are same zone unless that server is down. My spring boot version is 3.0.6
and spring cloud is 2022.0.2
.
Here is the config of my two eureka servers
server.port=8080
eureka.instance.hostname=sd-1
eureka.environment=prod
eureka.datacenter=region1
eureka.server.wait-time-in-ms-when-sync-empty=0
logging.level.root=DEBUG
eureka.client.region=region1
eureka.client.availability-zones.region1=zone1,zone2
eureka.client.serviceUrl.zone1=http://sd-1:8080/eureka
eureka.client.serviceUrl.zone2=http://sd-2:8080/eureka
server.port=8080
eureka.instance.hostname=sd-2
eureka.environment=prod
eureka.datacenter=region1
eureka.server.wait-time-in-ms-when-sync-empty=0
eureka.client.region=region1
eureka.client.availability-zones.region1=zone1,zone2
eureka.client.serviceUrl.zone1=http://sd-1:8080/eureka
eureka.client.serviceUrl.zone2=http://sd-2:8080/eureka
Here is my client service configuration
server.port=8889
spring.application.name=service3
spring.profiles.active=dev3
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.serviceId=configserver
spring.cloud.config.fail-fast=true
spring.cloud.config.retry.initialInterval=3000
spring.cloud.config.retry.multiplier=1.3
spring.cloud.config.retry.maxInterval=10000
spring.cloud.config.retry.maxAttempts=20
eureka.client.region=region1
eureka.client.availability-zones.region1=zone1,zone2
eureka.client.serviceUrl.zone1=http://sd-1:8080/eureka
eureka.client.serviceUrl.zone2=http://sd-2:8080/eureka
eureka.client.prefer-same-zone-eureka=true
eureka.instance.metadata-map.configPath=/config
eureka.instance.metadata-map.zone=zone1
Comment From: OlgaMaciaszek
Hello @dharshanrg. Thanks for reporting the issue. Please learn how to properly format code and logs.
Based on the provided config, it does not seem that you have set up zone-preference load-balancing for your client. Please consult the docs. If the issue persists, please provide a minimal, complete, verifiable example that reproduces the issue. Please use Spring Boot 3.2.x
and Cloud 2023.0.x
as these are the only versions that are currently in OSS support.
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-cloud-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.