Gateway怎样监控,以及出现问题怎样排查?
- 使用actuator监控
- 使用日志
一、添加配置
management: #actuator ,boot 健康,监控
endpoints:
web:
exposure:
include: gateway #当然暴露'*' 更好
二、使用
1. 查看
http://localhost:8040/actuator/gateway/globalfilters
2. 新增、修改
1. GET 访问http://localhost:8040/actuator/gateway/routes
2. 复制JSON数组中的一个路由,改成你新增的路由。
3. POST 访问http://localhost:8040/actuator/gateway/routes{名字}
4.POST 访问http://localhost:8040/actuator/gateway/refresh
5. GET 访问http://localhost:8040/actuator/gateway/routes
三、使用日志
加日志,按需将如下包的日志级别设置成 debug 或 trace 。
org.springframework.cloud.gateway
org.springframework.http.server.reactive
org.springframework.web.reactive
org.springframework.boot.autoconfigure.web
reactor.netty
redisratelimiter
logging:
level:
org.springframework.cloud.gateway: trace