问题描述
我们部署了一个Zuul代理(由Spring Cloud/Boot包裹),该代理从Spring Config Server获取配置.每次更改路由时,我都会重新启动Zuul应用程序,并且想知道是否可以采用更好的方法(例如刷新Zuul配置信息)? :)
We have a Zuul proxy (wraped with Spring Cloud/Boot) deployed that fetches configuration from the Spring Config Server. Every time I do changes in the routes I restart Zuul application and I wonder if there is a better approach that can be taken (like refresh of Zuul config information)? :)
谢谢
推荐答案
您可以通过rest发出刷新命令:
You can issue a refresh command via rest:
curl -X POST http://<host>:<port>/refresh
我编写了一个简单的bash脚本,将所有更改提交到Git存储库中的配置文件,然后向所有服务发出curl请求.
I wrote a simple bash script that commits all my changes to the config file in the Git repository and then issue curl request to all my services.
如果想花哨的话,可以编写一个脚本,该脚本首先查询Eureka
服务器以获取所有服务的列表,然后刷新所有:)
If you wanted to be fancy you could write a script that first queries your Eureka
server to get the list of all services and then refresh them all :)
这篇关于使用Spring Config Service时刷新Zuul配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!