4.eureka控制台顯示注冊的服務IP以及心跳間隔和服務續約時間設置


1.顯示IP

效果預覽:

 

 配置yml:

eureka:
  client:
    service-url:
      defaultZone: http://localhost:9000/eureka/,http://localhost:8000/eureka/  #多個eurekaserver之間通過","分割
  instance:
    prefer-ip-address: true #使用IP地址注冊
    instance-id: ${spring.cloud.client.ip-address}:${server.port}   #向注冊中心注冊我們的IP和端口

2.設置心跳間隔和服務續約時間

eureka:
  client:
    service-url:
      defaultZone: http://localhost:9000/eureka/,http://localhost:8000/eureka/  #多個eurekaserver之間通過","分割
  instance:
    prefer-ip-address: true #使用IP地址注冊
    instance-id: ${spring.cloud.client.ip-address}:${server.port}   #向注冊中心注冊我們的IP和端口
    lease-renewal-interval-in-seconds: 5    #設置向注冊中心發送心跳的時間,默認是30秒
    lease-expiration-duration-in-seconds: 10  #設置預約到期時間默認是90秒

停止服務之后,10秒之后注冊中心會把該服務移除

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM