This is about spring config client.
I have three things running on my system.
- Discovery
- Spring Config Server
- Spring Config Client/ Eureka Client
APPROACH: DISCOVERY FIRST BOOTSTRAP + RETRY
DOCUMENTATION CITED: https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_client.html
Before: I was able to register spring config server and client on discovery and the client was able to get the properties well from the config server. The order is discovery first and then the config server and finally the client. using discovery first bootstrap and retry.
Problem : It is fine and no problem and the client is able to register itself in zoneXYZ.
Verified: org.springframework.cloud.client.discovery.DiscoveryClient#getServices and able to see the client as a service
After I change: I have introduced the retry functionality so that if in case the client gets started first and then the config server, the client will keep on retrying until it finds the config service and once it finds it , it fetches the properties.
Problem : Once the config client is waiting for the config server and after sometimes it gets the config service and registers itself in eureka, the client is visible on eureka dashboard but is not being able to register it self in zoneXYZ.
Verified: org.springframework.cloud.client.discovery.DiscoveryClient#getServices and NOT able to see the client as a service
END OF STEP 1
WORKS WHEN : The client is restarted
Verified: org.springframework.cloud.client.discovery.DiscoveryClient#getServices shows the client as a service`
END OF STEP 2
CONFIGURATIONS AS FOLLOWS:
CONFIG CLIENT (bootstrap.properties)
spring.application.name=my-application
server.port=8443
spring.profiles.active=local
spring.cloud.config.label=latest
management.endpoints.web.exposure.include=*
#Spring cloud configuration via Eureka Discovery
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=my-config-service
#Logging related
logging.level.org.springframework.cloud.bus=DEBUG
logging.level.org.springframework.retry=TRACE
logging.level.com.netflix.discovery=DEBUG
spring.cloud.config.fail-fast=true
#including retry maxInterval etc
#Eureka
register.with.eureka=true
eureka.client.instance.preferIpAddress = true
eureka.instance.leaseRenewalIntervalInSeconds=10
eureka.instance.leaseExpirationDurationInSeconds=15
eureka.instance.appname=${spring.application.name}
eureka.instance.hostname=${HOST:localhost}
eureka.instance.nonSecurePort=:${server.port}
eureka.instance.instance-id=${spring.application.name}:${server.port}
eureka.instance.ipAddress=${HOST:localhost}
eureka.instance.home-page-url=${HOST:${eureka.instance.hostname}}:${${server.port}}/${spring.application.name}
eureka.client.preferSameZoneEureka=true
eureka.client.region=region-1
eureka.client.availabilityZones.region-1=zoneXYZ --> APP REGISTERED here without RETRY
eureka.instance.metadataMap.zone=zoneXYZ
CONFIG SERVICE(application properties)
spring.application.name=my-config-service
server.port=8888
spring.cloud.config.server.prefix=/config
#Spring Config Server
spring.cloud.config.server.jdbc.sql= SELECT KEY, VALUE from MY_CONFIG_PROPERTIES where APPLICATION=? and PROFILE=? and LABEL=?
spring.profiles.active=local, jdbc
spring.cloud.config.server.bootstrap=true
#Logging
logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG
logging.level.org.springframework.jdbc.core.StatementCreatorUtils=TRACE
management.security.enabled=false
management.endpoint.health.show-details=always
#Spring Cloud Bus
management.endpoints.web.exposure.include=*
spring.cloud.bus.enabled=true
spring.cloud.bus.trace.enabled=true
#Discovery specific
register.with.eureka=true
eureka.client.instance.preferIpAddress = true
eureka.instance.leaseRenewalIntervalInSeconds=10
eureka.instance.leaseExpirationDurationInSeconds=15
eureka.instance.appname=${spring.application.name}
eureka.instance.hostname=${HOST:localhost}
eureka.instance.nonSecurePort=${server.port}
eureka.instance.instance-id=${spring.application.name}:${server.port}}
eureka.instance.ipAddress=${localhost}
eureka.instance.home-page-url=${HOST:${eureka.instance.hostname}}:${${server.port}}/${spring.application.name}
eureka.client.prefer-same-zone-eureka=true
eureka.client.region=region-1
eureka.client.availability-zones.region-1=zoneXYZ
eureka.instance.metadataMap.zone=zoneXYZ
eureka.client.prefer-same-zone-eureka=true
eureka.client.region=region-1
eureka.client.availability-zones.region-1=zoneXYZ
eureka.instance.metadataMap.zone=zoneXYZ
Comment From: spencergibb
I'm afraid I don't understand the following statement.
the client is visible on eureka dashboard but is not being able to register it self in zoneXYZ.
Comment From: pivotghub
I'm afraid I don't understand the following statement.
the client is visible on eureka dashboard but is not being able to register it self in zoneXYZ.
Actually DiscoveryClient#getServices Is not able to find the client or any micro service though that particular service is visible on eureka dashboard
Comment From: OlgaMaciaszek
Please provide a minimal, complete, verifiable example that reproduces the issue.
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.