What is the recommended configuration when running both Config Server with Eureka Server? Should Config Server be a client of Eureka? Or should Eureka be dependent on Config Server properties for its configuration? Or is both OK?
-
1I could only get it to work with centralizing the config for Eureka clients on the Config Server -- which for my setup seems better as the config to reach the config server is 1 line versus 6 lines for setting up Eureka and "auto-discover" the Config Server. Also, when I tried the auto-discover, I ended up getting errors with Eureka saying "No qualifying bean of type [com.netflix.appinfo.EurekaInstanceConfig] is defined: expected single matching bean but found 2: eurekaInstanceConfig,eurekaInstanceConfigBean". What did you end up deciding to do? What worked for you? – Todd Dec 04 '15 at 16:41
-
Yes, I haven't finished implementing it yet, but that's what I'm planning to do, have Eureka be a client of Config Server. – Turar Dec 06 '15 at 23:07
4 Answers
The default way to use Eureka and Config Server is to use Config First bootstrap. Essentially, you make eureka server a client of the config server but you don't make the config server a client of eureka.
As said by David Syer on these (and this) issues, the founder of spring cloud, you have to use the config server with a front end load balancer, so a single URL is already highly available.
I'm also a newbie in Spring Cloud but I agree with him since Eureka is a Service Discovery, IMHO it should function on it's problem domain only. It would make a complicated logic for Eureka servers who are asking the Config servers for it's configuration. I can't imagine how the Eureka Server would know which config server to get if the Config Server is also the Server of Eureka to get its list of defaultZone.
It would be much more simpler for me to separate the Config Server's HA.

- 398
- 3
- 9
Based on @Mideel's answer
Eureka and Config Client configuration (needs to be Bootstrap):
# bootstrap.yml
cloud:
config:
discovery:
enabled: true # This is required
service-id: configserver # Config Server's eureka registry name
enabled: true # This is default true already
Config Server configuration:
spring:
application:
name: configserver # Needs to match client configuration
Register the Config Server with the annotation @EnableEurekaClient
(it should be Auto Configured to register with Eureka already though)

- 2,820
- 4
- 29
- 56
-
I think normalized name should be `serviceId` service-id is .properties file syntax – Davut Gürbüz Aug 26 '20 at 11:37
The Spring Cloud Config service provides configuration info for various other microservices, of which the Eureka service is one.
Each app/microservice is pointed to its configuration (from the Config service) via bootstrap.properties/.yml, which is loaded in the parent context for that application, before the app "recognizes" that it is a discovery/Eureka client per its annotated main class. This bit of documentation provides a bit more detail on that process.
Cheers, Mark

- 126
- 1
- 7
EDIT1: I think this is a wrong answer, see the replies
If you use Spring Boot:
I'm using Spring Microservices in Action as my guide book and based on the source code example there, we make the configuration server as the Eureka Client with the @EnableEurekaClient
annotation and in the config server application.yml, we need to add this property:
spring:
cloud:
config:
discovery:
enabled: true
And in the other Eureka client that uses this config server, you need to add this property to the application.yml :
spring:
cloud:
config:
enabled: true
That's it, just set up the config server normally, I think behind the scene the config libraries from spring cloud will take care of the rest using Eureka.

- 801
- 7
- 16
-
1This answer is not correct. `spring.cloud.config.discovery.enabled` is not for the config server, it's for every application needing to use the config server. The second property `spring.cloud.config.discovery.service-id` is the config server's application name registered with eureka. – George Feb 28 '20 at 19:24
-
@George yeah after Googling around I think you're right. But I misunderstood because everything still works even without the client specifying spring.cloud.config.discovery.enabled – Mideel Mar 01 '20 at 10:30
-
Your answer pointed me in the right direction anyways. That's good. Googling about eureka and cloud config brings me here so I threw in my own answer. Thanks. – George Mar 01 '20 at 12:31
-
[Here](https://projects.spring.io/spring-cloud/spring-cloud.html#eureka-first-bootstrap) is the link to the documentation explaining what @George called out. – dbaltor Jul 17 '20 at 11:08