Let's look at an example:
spring: application: name: cms-discovery-eureka-ha --- spring: profiles: peer1 server: port: 9092 eureka: instance: hostname: peer1 client: serviceUrl: defaultZone: http://peer2:9093/eureka/ --- spring: profiles: peer2 server: port: 9093 eureka: instance: hostname: peer2 client: serviceUrl: defaultZone: http://peer1:9092/eureka/
How to use: If the generated package is named cms-eureka-ha.jar
java -jar cms-eureka-ha.jar --spring.profiles.active=peer1
java -jar cms-eureka-ha.jar --spring.profiles.active=peer2
Specify which profile to use to start with spring.profiles.active.
Recommended articles: https://my.oschina.net/u/2278977/blog/807958