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秒之后注册中心会把该服务移除

 

posted @ 2020-08-27 10:56  指尖下的世界  阅读(744)  评论(0编辑  收藏  举报
/* 看板娘 */ /*炸泡*/
/* 鼠标点击求赞文字特效 */