Spring cloud registering multiple instances of the same service
I am developing a microservice using Spring Boot which provides a REST endpoint. Due to scalability, I have to run multiple instances of these services on a different port. What will be the configurations for the applications so that they can register with eureka and the requests are load balanced? I am using Spring cloud config, Eureka server and zuul.
source to share
I am assuming you wanted to register with Eureka
a server instead Config
.
To register multiple instances that can run on the same host but listening on a different port, you need to set eureka.instance.metadataMap.instanceId
to a unique value, perhaps using:
eureka.instance.metadataMap.instanceId=${spring.application.name}:${random.int}
source to share