Eureka中的服务状态显示UNKOWN(1)

Spring cloud在加入Config配置中心后,Eureka中的服务状态显示为UNKOUNW(1),Eureka的client端显示如下注册状态为204,重新注册。

Eureka服务端:

 Eureka client端:

2018-11-02 15:16:13.715 [DiscoveryClient-HeartbeatExecutor-0] INFO  com.netflix.discovery.DiscoveryClient - DiscoveryClient_CHINESENER/BigData:chinesener:8081 - registration status: 204
2018-11-02 15:16:23.722 [DiscoveryClient-HeartbeatExecutor-0] INFO  com.netflix.discovery.DiscoveryClient - DiscoveryClient_CHINESENER/BigData:chinesener:8081 - Re-registering apps/CHINESENER

 配置文件原来写在application.yml文件中,后来该写到了bootstrap.yml文件中。文件内容没有改变,如下:

eureka:
  instance:
    hostname: localhost
    lease-expiration-duration-in-seconds: 30 # 续约到期时间(默认90秒)
    lease-renewal-interval-in-seconds: 10 	# 续约更新时间间隔(默认30秒)
  client:
    healthcheck:
      enabled: true #改变eureka server对客户端健康检查方式
    register-with-eureka: true #是否注册到eureka服务器
    fetch-registry: true #是否可检索
    service-url:
      defaultZone: http://localhost:8080/eureka/ #服务中心
server:
  tomcat:
      max-http-post-size: -1 #设置接收任意大小的数据
  port: 8081
#读取配置信息
spring:
  application:
    name: chinesener
  cloud:
    config:
      label: master
      profile: config-dev
     #uri: http://localhost:8888/
      discovery: #分布式环境下自动发现配置服务
        enabled: true
        serviceId: config-server
management:
  security: false

虽然有问题,但是服务一直可用,但是总觉的不是很舒服,就找了一下解决方法。查到了这位大哥的博文,https://www.codercto.com/a/24528.html

我将eureka.client.healthcheck.enabled=true注释掉,重启服务,ok,一切正常了!

后来想,既然是spring家族的问题,在spring官网上一定有答案,还真查找了,http://cloud.spring.io/spring-cloud-netflix/multi/multi__service_discovery_eureka_clients.html

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值