12.1 How to Include Eureka Server
pom.xml import
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency>12.2 How to Run a Eureka Server
startup class
@SpringBootApplication @EnableEurekaServer public class Application { public static void main(String[] args) { new SpringApplicationBuilder(Application.class).web(true).run(args); } }
12.4 Standalone Mode
server: port: 8761 eureka: instance: hostname: localhost client: registerWithEureka: false #Whether to register with other eureka fetchRegistry: false #Whether to merge into other eureka serviceUrl: defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/12.5. Peer Awareness
--- spring: profiles: peer1 eureka: instance: hostname: peer1 client: serviceUrl: defaultZone: http://peer2/eureka/ --- spring: profiles: peer2 eureka: instance: hostname: peer2 client: serviceUrl: defaultZone: http://peer1/eureka/