不想在数据库中存储属性

发布于 01-14 16:28 字数 181 浏览 5 评论 0原文

我的微服务中有一些属性。它们发生了很大的变化,所以我想将它们存储在微服务之外的某个地方,这样我就不必一次又一次地取消部署。一种解决方案是将它们存储在数据库中,但这样效率会较低。您能告诉我一个可以存储它们的解决方案吗?

基本上这个微服务被很多人使用。我希望在部署微服务时读取该文件一次(除非或直到文件发生某些更改)以最大程度地减少调用。

I have some properties in my microservice. They are changed a lot so I want to store them somewhere out of microservice so that I don't have to undeploy it again and again. One solution is to store them in database but it will be less efficient that way. Can you advise me a solution where I can store them?

Basically this microservice is used by a vast number of people. I want that file to be read ONCE when microservice is deployed (unless or until there is some change in the file) to minimize the calls.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

丘比特射中我2025-01-21 16:28:15

您应该使用 Spring Cloud Config ,它可以使用集中式服务器它公开了一个 Git Repo,您​​可以使用它来存储特定于环境的配置文件(application.properties)

You should use Spring Cloud Config which enables to use a centralized server which exposes a Git Repo which you can use to store environment specific configuration files (application.properties)

顾挽2025-01-21 16:28:15

你应该选择集中配置,Spring Cloud支持配置服务器,强烈推荐微服务架构。
供参考:https://spring.io/guides/gs/centralized-configuration/

基本上,您有一个集中位置来存储所有配置,并且不需要每次更改配置时都重新部署应用程序。

注意:如果您更改数据库属性,则可能需要重新启动服务

You should go with Centralized configuration, spring cloud supports config server, It is highly recommended for microservice architecture.
For reference: https://spring.io/guides/gs/centralized-configuration/

Basically, you have a centralized place to store all the configurations and don't need the redeploy the application every time you change the configs.

NOTE: in case you change the db properties then probably you need the restart the service

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文