Building the example application

For the Eureka Server, all of the required changes may be defined in configuration properties. In the application.yml file, I defined three different profiles for each instance of the discovery service. Now, if you try to run Eureka Server embedded in the Spring Boot application, you need to activate the specific profile by providing the VM argument -Dspring.profiles.active=peer[n], where [n] is the instance sequence number:

spring: profiles: peer1eureka: instance:   hostname: peer1   metadataMap:     zone: zone1 client:   serviceUrl:     defaultZone: http://localhost:8762/eureka/,http://localhost:8763/eureka/server:  port: ${PORT:8761}---spring: profiles: peer2eureka: instance:   hostname: peer2   metadataMap: zone: zone2 ...

Get Mastering Spring Cloud now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.