简体   繁体   English

服务结构-更新静态配置文件

[英]Service fabric - Updating static configuration files

I am currenlty running an on-premise 3 node cluster with service fabric. 我目前正在运行带有服务结构的本地3节点群集。

I have a statefull service which has a .csv file containing a complex configuration for my service, and I would like to open a REST endpoint for updating this configuration dynamically. 我有一个有状态的服务,该服务的.csv文件包含服务的复杂配置,我想打开一个REST端点以动态更新此配置。

So, in order to sync the state I could use a reliable dictionary serialize my csv configuration and save it. 因此,为了同步状态,我可以使用可靠的字典序列化csv配置并保存它。

What I dont know how to do is to make sure that even after a power-shortage (which is defined as a non-reliable action), the configuration will be saved (since the CSV is saved on the working directory and not in the image store). 我不知道该怎么做,以确保即使在电源不足(定义为不可靠的动作)之后,也将保存配置(因为CSV保存在工作目录中而不是在映像中)商店)。

I thought about upgrading the service on each update of the CSV, but it seems really exxcessive and will result in multiple application versions provisioned. 我曾考虑过在每次CSV更新时都升级服务,但似乎确实很麻烦,并且会导致提供多个应用程序版本。 Is there any standard way to support this? 有什么标准的方法可以支持这一点吗?

If the .csv file is a requirement, one could treat the .csv file that is deployed with the service as default configuration. 如果.csv文件是一个要求,一个可以治疗.csv被部署与服务作为默认的配置文件。 So, when the service starts, it could perform the following actions to load in configuration: 因此,服务启动时,它可以执行以下操作以加载配置:

  1. Load the .csv default settings into memory. .csv默认设置加载到内存中。
  2. Load any settings stored in Reliable Collections and merge with the default settings previously loaded from the .csv file. 加载存储在“可靠集合”中的所有设置,并与先前从.csv文件加载的默认设置合并。

In this way, the dynamically updated settings will be replicated reliably due to using the Reliable Collections, and the .csv is already replicated due to being a default artifact deployed with all replicas of the service. 这样,由于使用了Reliable Collections,动态更新的设置将被可靠地复制,并且.csv已被复制,因为它是与服务的所有副本一起部署的默认工件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM