server:
port: 8761
spring:
application:
name: eureka-server
eureka:
server:
enable-self-preservation: true
eviction-interval-timer-in-ms: 60000
client:
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: http://peer2:8762/eureka/
server:
port: 8762
spring:
application:
name: eureka-server-2
eureka:
server:
enable-self-preservation: true
eviction-interval-timer-in-ms: 60000
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: http://peer1:8761/eureka/
server:
port: 8080
spring:
application:
name: eureka-client-a
eureka:
instance:
instance-id: ${spring.application.name}:${server.port}-1
prefer-ip-address: true
client:
serviceUrl:
fedaultZone: http://localhost:8761/eureka/
server:
port: 8081
spring:
application:
name: eureka-client-b
eureka:
instance:
instance-id: ${spring.application.name}:${server.port}-2
prefer-ip-address: true
client:
serviceUrl:
fedaultZone: http://localhost:8761/eureka/
```java
```java
package com.example.demo_eureka_clientb;
import org.springframework.web.bind.annotation.GetMapping;
@org.springframework.cloud.openfeign.FeignClient(value = "EUREKA-CLIENT-A")
public interface FeignClient {
@GetMapping("/hello")
public String hello();
}
@SpringBootApplication
@EnableFeignClients
public class DemoEurekaClientbApplication {
public static void main(String[] args) {
SpringApplication.run(DemoEurekaClientbApplication.class, args);
}
}