当前位置: 首页 > 知识库问答 >
问题:

Spring boot admin不从eureka获取注册表

罗宪
2023-03-14
server:
  port: 8762

spring:
  application:
    name: admin-server
  boot:
    admin:
      discovery:
        ignored-services: admin-server
#The admin server will automatically pick up all services at eureka and register them to itself.
eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
    health-check-url-path: /actuator/health
    metadata-map:
      startup: ${random.int}    #needed to trigger info and endpoint update after restart
  client:
    registryFetchIntervalSeconds: 5
    registerWithEureka: true #default true
    fetchRegistry: true #default true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

Eureka服务器配置:

server:
  port: 8761
spring:
  application:
    name: discovery-server
eureka:
  instance:
    hostname: localhost
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

几点思考:

  • 我们从spring boot 1.5.x迁移到2.0.x,安全性有问题吗?我们没有在任何地方使用spring-security,但我读到一些httpendpoint在默认情况下不再是“可到达的”或“活动的”。但我在管理服务器或eureka服务器的日志中没有看到有关此问题的错误或警告。
  • 我的其他应用程序的pom中都没有spring boot admin starter客户端依赖项,因为我不希望它是负责在管理控制台注册ith的部分,我希望它通过Eureka动态地完成
  • 除了管理服务器和eureka服务器之外,所有应用程序都使用config-server来获取它们的配置。这会导致问题吗?
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
spring:
  boot:
    admin:
      url: http://localhost:8762
management: #exposing all endpoints is not safe for production, especially not if spring security gets involved
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

共有1个答案

子车鸿运
2023-03-14

我在升级到SBA2时也遇到了同样的问题。

spring-boot、spring-cloud和SBA的版本应该匹配。我用过:

spring-boot:  2.0.7.RELEASE
spring-cloud: Finchley.SR2
SBA:          2.0.4

在我的例子中,诀窍是使用spring-boot-admin-starter-server作为依赖项,而不是普通的依赖项(spring-boot-admin-server,spring-boot-admin-server-ui,spring-boot-admin-server-cloud)如下所述:https://github.com/codecentric/spring-boot-admin/issues/776

 类似资料:
  • 我们是否可以通过python客户端获得在Eureka服务器中注册的服务名称和IP? 我查看了python eureka客户端教程页面,但找不到与此相关的任何内容!

  • 在本章中,您将详细了解如何将Spring Boot Micro服务应用程序注册到Eureka Server中。 在注册应用程序之前,请确保Eureka Server在端口8761上运行或首先构建Eureka Server并运行它。 有关构建Eureka服务器的更多信息,请参阅上一章。 首先,您需要在我们的构建配置文件中添加以下依赖项,以便向Eureka服务器注册微服务。 Maven用户可以将以下依

  • 我有一个工作中的Eureka注册表,其中注册了许多Spring-Boot应用程序。我知道这是有效的,因为他们能够找到对方,并通过尤里卡注册中心进行交流。 当我启动我的新SBA应用程序时,我可以看到它自己在Eureka注册表中注册,所以它正在查找Eureka。然而,当我打开SBA UI时,它是空的,只是说“没有应用程序注册。”在我的控制台上,我可以一遍又一遍地看到下面的堆栈跟踪。

  • 我目前正面临一个问题,即Eureka不能注销已注册的服务。我直接从git hub中提取了Eureka服务器示例,只做了一个更改,。我的application.yml如下所示: 到目前为止,一旦eureka客户端启动,它将在3秒内注册。它只是在服务突然终止时从不取消注册。在我终止服务后,Eureka仪表盘上写着: 紧急情况!EUREKA可能错误地声称实例已经出现,而它们不是.续约低于阈值,因此实例不

  • 我有两个Spring应用程序(“客户端应用程序”和“服务应用程序”),它们已经注册到Eureka(并通过外部客户端进行对话)。但是,我必须与Solr的一个实例交谈,我被迫在属性文件中硬编码IP地址。我宁愿不这样做,而是使用Eureka进行服务发现。 问:有没有一种方法/插件可以让solr向Eureka注册,这样客户端就可以发现它(即使它是通过启动侦听器或某种方式编程实现的)? 我看过SolrAPI

  • 我有一个Eureka服务器,我想在那里注册一个非常基本的SpringBoot服务。不幸的是,服务没有注册,尽管我试图跟踪所有的文章,我可以找到。 此外,当我检查DiscoveryClient的描述(得到autowired)时,我看到“Spring Cloud No-op DiscoveryClient”,它表明(根据noopDiscoveryClient.java源代码)没有找到Eureka客户机