All Projects → apolloconfig → apollo.net

apolloconfig / apollo.net

Licence: Apache-2.0 license
Apollo配置中心.Net客户端

Programming Languages

C#
18002 projects
powershell
5483 projects

Projects that are alternatives of or similar to apollo.net

Apollo.net
Apollo配置中心.Net客户端
Stars: ✭ 165 (-63.25%)
Mutual labels:  apollo, config-management, configuration, configuration-management
Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (+43.21%)
Mutual labels:  config-management, configuration, configuration-management
Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (+103.79%)
Mutual labels:  config-management, configuration, configuration-management
Config
A lightweight yet powerful config package for Go projects
Stars: ✭ 126 (-71.94%)
Mutual labels:  config-management, configuration
apollo
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
Stars: ✭ 26,228 (+5741.43%)
Mutual labels:  config-management, configuration-management
Apollo
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
Stars: ✭ 26,052 (+5702.23%)
Mutual labels:  config-management, configuration-management
Simple Settings
A simple way to manage your project settings.
Stars: ✭ 165 (-63.25%)
Mutual labels:  configuration, configuration-management
apollo-docker
Apollo阿波罗配置中心docker
Stars: ✭ 23 (-94.88%)
Mutual labels:  apollo, configuration
Mgmt
Next generation distributed, event-driven, parallel config management!
Stars: ✭ 2,708 (+503.12%)
Mutual labels:  config-management, configuration-management
Agollo
🚀Go client for ctrip/apollo (https://github.com/ctripcorp/apollo)
Stars: ✭ 348 (-22.49%)
Mutual labels:  apollo, configuration-management
sitri
Sitri - powerful settings & configs for python
Stars: ✭ 20 (-95.55%)
Mutual labels:  configuration, configuration-management
Simple-YAML
A Java API that provides an easy-to-use way to store data using the YAML format.
Stars: ✭ 68 (-84.86%)
Mutual labels:  config-management, configuration
vyper
Python configuration with (more) fangs
Stars: ✭ 121 (-73.05%)
Mutual labels:  config-management, configuration-management
standalone-configuration-management
Basic examples of how to use each of chef, puppet, salt and ansible as standalone configuration management systems.
Stars: ✭ 14 (-96.88%)
Mutual labels:  config-management, configuration-management
Microconfig
Modern tool for microservice configuration management
Stars: ✭ 180 (-59.91%)
Mutual labels:  configuration, configuration-management
agollo
🚀Go client for ctrip/apollo (https://github.com/apolloconfig/apollo)
Stars: ✭ 563 (+25.39%)
Mutual labels:  apollo, configuration-management
Qconf
Qihoo Distributed Configuration Management System
Stars: ✭ 1,843 (+310.47%)
Mutual labels:  configuration, configuration-management
Libelektra
Elektra serves as a universal and secure framework to access configuration parameters in a global, hierarchical key database.
Stars: ✭ 155 (-65.48%)
Mutual labels:  configuration, configuration-management
superconfig
Access environment variables. Also includes presence validation, type coercion and default values.
Stars: ✭ 33 (-92.65%)
Mutual labels:  configuration, configuration-management
libconfini
Yet another INI parser
Stars: ✭ 106 (-76.39%)
Mutual labels:  configuration, configuration-management

Apollo配置中心的.Net客户端,更多关于Apollo配置中心的介绍,可以查看Apollo配置中心Wiki

一、框架集成

  1. Microsoft.Extensions.Configuration集成请参考Apollo.Configuration,完全支持IConfiguration的变动通知
  2. System.Configuration.ConfigurationManager集成(.net 4.7.1及以后版本)或直接使用ApolloConfigurationManager请参考Apollo.ConfigurationManager
  3. 如果想将传统的config配置(如web.config)转成json配置,可以使用config2json工具

二、日志输出

默认Sdk内部的日志不会输出,需要输出日志的请设置Com.Ctrip.Framework.Apollo.Logging.LogManager.LogFactory属性。

内部内实现了控制台日志

LogManager.UseConsoleLogging(logLevel);

三、客户端设计

client-architecture

上图简要描述了Apollo客户端的实现原理:

  1. 客户端和服务端保持了一个长连接,从而能第一时间获得配置更新的推送。(通过Http Long Polling实现)
  2. 客户端还会定时从Apollo配置中心服务端拉取应用的最新配置。
    • 这是一个fallback机制,为了防止推送机制失效导致配置不更新
    • 客户端定时拉取会上报本地版本,所以一般情况下,对于定时拉取的操作,服务端都会返回304 - Not Modified
    • 定时频率默认为每5分钟拉取一次,客户端也可以通过App.config设置Apollo.RefreshInterval或者appsettings.json设置Apollo:RefreshInterval来覆盖,单位为毫秒。
  3. 客户端从Apollo配置中心服务端获取到应用的最新配置后,会保存在内存中
  4. 客户端会把从服务端获取到的配置在本地文件系统缓存一份
    • 在遇到服务不可用,或网络不通的时候,依然能从本地恢复配置
  5. 应用程序可以从Apollo客户端获取最新的配置、订阅配置更新通知

四、本地开发模式

当开发环境无法连接Apollo服务器的时候,会降级为读取本地配置文件,请先在普通模式下使用Apollo,这样Apollo会自动创建该目录并在目录下生成配置文件。

Apollo不会实时监测文件内容是否有变化,所以如果修改了配置,需要重启应用生效。

4.1 本地配置目录

本地配置目录位于:

  • Mac/Linux: /opt/data/{appId}/config-cache
  • Windows: C:\opt\data\{appId}\config-cache

appId就是应用的appId,如100004458。

请确保该目录存在,且应用程序对该目录有读权限。

【小技巧】 推荐的方式是先在普通模式下使用Apollo,这样Apollo会自动创建该目录并在目录下生成配置文件。

4.2 本地配置文件

本地配置文件需要按照一定的文件名格式放置于本地配置目录下,文件名格式如下:

{appId}+{cluster}+{namespace}.json

  • appId就是应用自己的appId,如100004458
  • cluster就是应用使用的集群,一般在本地模式下没有做过配置的话,就是default
  • namespace就是应用使用配置namespace,一般是application client-local-cache

文件内容以json格式存储,比如如果有两个key,一个是request.timeout,另一个是batch,那么文件内容就是如下格式:

{
    "request.timeout":"1000",
    "batch":"2000"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].