服务端
spring:
application:
name: eureka-server
security:
user:
name: v #安全认证名字
password: 123456 #密码
server:
port: 8761
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka # Eureka Client 向Eureka Server进行注册的地址
_register-with-eureka: true # 是否向Eureka Server 进行注册
fetch-registry: true # 是否向eureka server抓取注册信息
server:
renewal-threshold-update-interval-ms: 30000 # 续约阈值的更新时间 默认15分钟
wait-time-in-ms-when-sync-empty: 10000 # 等待时间
enable-self-preservation: false # 关闭自我保护机制
eviction-interval-timer-in-ms: 3000
instance:
lease-renewal-interval-in-seconds: 30 # 每间隔5秒发送一次心跳请求
lease-expiration-duration-in-seconds: 90 # 服务的失效时间
客户端
spring:
application:
name: eureka-client
server:
port: 8888
eureka:
client:
service-url:
defaultZone: http://v:123456@localhost:8761/eureka,http://v:123456@localhost:8762/eureka
registry-fetch-interval-seconds: 30 # 在Eureka Server中获取服务列表的间隔时间
instance:
lease-expiration-duration-in-seconds: 90
lease-renewal-interval-in-seconds: 30
prefer-ip-address: true # 使用IP地址进行注册
_instance-id: ${spring.cloud.client.ip-address}:${server.port}
hostname: ${spring.cloud.client.ip-address}
服务端
客户端