如何使用 Zuul(没有 Eureka,Spring Cloud)公开 Actuator 端点?
How to expose Actuator endpoints with Zuul (no Eureka, Spring Cloud)?
我有一个 Spring 云应用程序用作 Zuul 服务器(带有 @EnableZuulProxy)注释。在此阶段,我将 /api/* 请求路由到适当的中间层服务,而所有其他请求都路由到表示服务,因此从配置 pov 来看,它如下所示:
zuul:
ignoredServices: '*'
routes:
reservation-owner:
path: /api/service1
url: http://service1.net
--- here couple of other api mappings --
ui:
path: /**
url: http://presentation-service.net/
在我想检查 zuul 代理上的任何 Actuator 端点之前,这非常有用。由于它们属于 /**,因此它们被路由到演示服务。
我已经尝试设置特定端点以路由回 zuul 服务器,但如果我是对的,我最终会遇到 zuul 调用自身的无限循环。因此,如果我是对的,我正在寻找一种方法来定义演示服务的路径,该路径将包括除例如之外的所有内容。 /admin/* 端点。可能吗?或者应该采取另一种方法?
一旦你设置 /**
zuul 吞下所有请求。那时唯一的方法是设置 management port.
management.port=8081
pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.yml:
management:
endpoints:
web:
exposure:
include: "*"
执行器端点here
修改 application.yaml
对我有用,可以路由和过滤端点:
management:
endpoints:
web:
exposure:
include: 'routes,filters'
我有一个 Spring 云应用程序用作 Zuul 服务器(带有 @EnableZuulProxy)注释。在此阶段,我将 /api/* 请求路由到适当的中间层服务,而所有其他请求都路由到表示服务,因此从配置 pov 来看,它如下所示:
zuul:
ignoredServices: '*'
routes:
reservation-owner:
path: /api/service1
url: http://service1.net
--- here couple of other api mappings --
ui:
path: /**
url: http://presentation-service.net/
在我想检查 zuul 代理上的任何 Actuator 端点之前,这非常有用。由于它们属于 /**,因此它们被路由到演示服务。
我已经尝试设置特定端点以路由回 zuul 服务器,但如果我是对的,我最终会遇到 zuul 调用自身的无限循环。因此,如果我是对的,我正在寻找一种方法来定义演示服务的路径,该路径将包括除例如之外的所有内容。 /admin/* 端点。可能吗?或者应该采取另一种方法?
一旦你设置 /**
zuul 吞下所有请求。那时唯一的方法是设置 management port.
management.port=8081
pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.yml:
management:
endpoints:
web:
exposure:
include: "*"
执行器端点here
修改 application.yaml
对我有用,可以路由和过滤端点:
management:
endpoints:
web:
exposure:
include: 'routes,filters'