如何解决Spring Boot 应用程序在 Eureka 服务器中显示为 UNKNOWN
我正在使用 Spring 运行一个应用程序(作为 discovery Client 应用程序),还有一个带有 Eureka 的 discovery Server 和 Spring Cloud Config Server。当客户端应用程序启动时,它在 Eureka 中注册为“UNKNowN”,尽管其状态设置为“UP”,但无法从配置服务器获取属性。
客户端应用、Eureka 服务器和配置服务器 Spring Boot 版本:2.4.2
客户端 bootstrap.properties:
spring.application.name=config-client-app
spring.cloud.config.discovery.enabled=true
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
eureka.instance.instance-id=${spring.application.name}
客户端 application.properties 文件:
logging.level.=debug
server.port=8900
eureka.client.healthcheck.enabled=true
客户端应用程序类:
@SpringBootApplication
@EnablediscoveryClient
@RestController
public class ConfigClientAppApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigClientAppApplication.class,args);
}
}
spring.application.name=discovery-server
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
尤里卡应用类:
@EnableEurekaServer
@SpringBootApplication
public class discoveryServerApplication {
public static void main(String[] args) {
SpringApplication.run(discoveryServerApplication.class,args);
}
}
日志信息:
restartedMain] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator ondemand update allowed rate per min is 4
2021-02-09 16:02:50.388 INFO 2845 --- [ restartedMain] com.netflix.discovery.discoveryClient : discovery Client initialized at timestamp 1612904570388 with initial instances count: 1
2021-02-09 16:02:50.390 INFO 2845 --- [ restartedMain] o.s.c.n.e.s.EurekaServiceRegistry : Registering application UNKNowN with eureka with status UP
2021-02-09 16:02:50.391 INFO 2845 --- [nfoReplicator-0] com.netflix.discovery.discoveryClient : Saw local status change event StatusChangeEvent [timestamp=1612904570391,current=UP,prevIoUs=STARTING]
2021-02-09 16:02:50.391 INFO 2845 --- [nfoReplicator-0] com.netflix.discovery.discoveryClient : discoveryClient_UNKNowN/192.168.10.22:8900: registering service...
2021-02-09 16:02:50.391 WARN 2845 --- [ restartedMain] c.n.discovery.InstanceInfoReplicator : Ignoring ondemand update due to rate limiter
2021-02-09 16:02:50.393 INFO 2845 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8900 (http) with context path ''
2021-02-09 16:02:50.394 INFO 2845 --- [ restartedMain] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8900
2021-02-09 16:02:50.413 INFO 2845 --- [nfoReplicator-0] com.netflix.discovery.discoveryClient : discoveryClient_UNKNowN/192.168.10.22:8900 - registration status: 204
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。