+
+ 配置项 |
+ 说明 |
+ 是否必填 |
+ 默认值 |
+
+
+ disconf.conf_server_host |
+ 配置服务器的 HOST,用逗号分隔 ,示例:127.0.0.1:8000,127.0.0.1:8000 |
+ 是 |
+ 必填 |
+
+
+ disconf.app |
+ APP 请采用 产品线_服务名 格式 |
+ 否 |
+ 优先读取命令行参数,然后再读取此文件的值 |
+
+
+ disconf.version |
+ 版本号, 请采用 X_X_X_X 格式 |
+ 否 |
+ 默认为 DEFAULT_VERSION。优先读取命令行参数,然后再读取此文件的值,最后才读取默认值。 |
+
+
+ disconf.enable.remote.conf |
+ 是否使用远程配置文件,true(默认)会从远程获取配置, false则直接获取本地配置 |
+ 否 |
+ false |
+
+
+ disconf.env |
+ 环境 |
+ 否 |
+ 默认为 DEFAULT_ENV。优先读取命令行参数,然后再读取此文件的值,最后才读取默认值 |
+
+
+ disconf.ignore |
+ 忽略的分布式配置,用空格分隔 |
+ 否 |
+ 空 |
+
+
+ disconf.debug |
+ 调试模式。调试模式下,ZK超时或断开连接后不会重新连接(常用于client单步debug)。非调试模式下,ZK超时或断开连接会自动重新连接。 |
+ 否 |
+ false |
+
+
+ disconf.conf_server_url_retry_times |
+ 获取远程配置 重试次数,默认是3次 |
+ 否 |
+ 3 |
+
+
+ disconf.conf_server_url_retry_sleep_seconds |
+ 获取远程配置 重试时休眠时间,默认是5秒 |
+ 否 |
+ 5 |
+
+
+ disconf.user_define_download_dir |
+ 用户定义的下载文件夹, 远程文件下载后会放在这里。注意,此文件夹必须有有权限,否则无法下载到这里 |
+ 否 |
+ ./disconf/download |
+
+
+ disconf.enable_local_download_dir_in_class_path |
+ 下载的文件会被迁移到classpath根路径下,强烈建议将此选项置为 true(默认是true) |
+ 否 |
+ true |
+
+
+
+### 自定义 disconf.properties 文件的路径
+
+一般情况下,disconf.properties 应该放在应用程序的根目录下,如果想自定义路径可以使用:
+
+ -Ddisconf.conf=/tmp/disconf.properties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/source/config/index.rst b/docs/source/config/index.rst
new file mode 100644
index 000000000..935b77d94
--- /dev/null
+++ b/docs/source/config/index.rst
@@ -0,0 +1,8 @@
+配置项
+=====
+
+.. toctree::
+ :maxdepth: 2
+ :numbered: 2
+
+ src/client-config
diff --git a/docs/source/config/src/client-config.rst b/docs/source/config/src/client-config.rst
new file mode 100644
index 000000000..0f6f1282a
--- /dev/null
+++ b/docs/source/config/src/client-config.rst
@@ -0,0 +1,97 @@
+client配置
+==========
+
+Disconf-Client
+--------------
+
+配置文件 disconf.properties 说明
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+所有配置均可以通过 命令行 ``-Dname=value`` 参数传入。
+
+.. raw:: html
+
+
+
+ 配置项 |
+ 说明 |
+ 是否必填 |
+ 默认值 |
+
+
+ disconf.conf_server_host |
+ 配置服务器的 HOST,用逗号分隔 ,示例:127.0.0.1:8000,127.0.0.1:8000 |
+ 是 |
+ 必填 |
+
+
+ disconf.app |
+ APP 请采用 产品线_服务名 格式 |
+ 否 |
+ 优先读取命令行参数,然后再读取此文件的值 |
+
+
+ disconf.version |
+ 版本号, 请采用 X_X_X_X 格式 |
+ 否 |
+ 默认为 DEFAULT_VERSION。优先读取命令行参数,然后再读取此文件的值,最后才读取默认值。 |
+
+
+ disconf.enable.remote.conf |
+ 是否使用远程配置文件,true(默认)会从远程获取配置, false则直接获取本地配置 |
+ 否 |
+ false |
+
+
+ disconf.env |
+ 环境 |
+ 否 |
+ 默认为 DEFAULT_ENV。优先读取命令行参数,然后再读取此文件的值,最后才读取默认值 |
+
+
+ disconf.ignore |
+ 忽略的分布式配置,用空格分隔 |
+ 否 |
+ 空 |
+
+
+ disconf.debug |
+ 调试模式。调试模式下,ZK超时或断开连接后不会重新连接(常用于client单步debug)。非调试模式下,ZK超时或断开连接会自动重新连接。 |
+ 否 |
+ false |
+
+
+ disconf.conf_server_url_retry_times |
+ 获取远程配置 重试次数,默认是3次 |
+ 否 |
+ 3 |
+
+
+ disconf.conf_server_url_retry_sleep_seconds |
+ 获取远程配置 重试时休眠时间,默认是5秒 |
+ 否 |
+ 5 |
+
+
+ disconf.user_define_download_dir |
+ 用户定义的下载文件夹, 远程文件下载后会放在这里。注意,此文件夹必须有有权限,否则无法下载到这里 |
+ 否 |
+ ./disconf/download |
+
+
+ disconf.enable_local_download_dir_in_class_path |
+ 下载的文件会被迁移到classpath根路径下,强烈建议将此选项置为 true(默认是true) |
+ 否 |
+ true |
+
+
+
+自定义 disconf.properties 文件的路径
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+一般情况下,disconf.properties
+应该放在应用程序的根目录下,如果想自定义路径可以使用:
+
+::
+
+ -Ddisconf.conf=/tmp/disconf.properties
diff --git "a/docs/source/design/Zookeeper\345\274\202\345\270\270\350\200\203\350\231\221.md" "b/docs/source/design/Zookeeper\345\274\202\345\270\270\350\200\203\350\231\221.md"
new file mode 100644
index 000000000..265307f88
--- /dev/null
+++ "b/docs/source/design/Zookeeper\345\274\202\345\270\270\350\200\203\350\231\221.md"
@@ -0,0 +1,72 @@
+disconf的Zookeeper异常考虑
+==========
+
+##disconf-web的ZK异常处理##
+
+disconf-web可以完全保证在任何情况下,与ZK集群的自动连接。
+
+下面按情况进行分析:
+
+###服务启动前,zk连接不上:
+
+- 开始连接不上:
+ - apache ZK client自身会自动(永久)去连接ZK server. 但是一直连接不上。
+ - 因此,web上所有操作均会失败,抛大异常,请求失败,只会重试一次,不会重试多次
+- 后面突然连接上了:
+ - apache ZK client 收到server SyncConnected消息。
+ - 这时所有操作均成功
+- 后面又突然连接不上了:
+ - apache ZK client 收到server Disconnected 消息。
+ - 这时,apache ZK client自身会自动(永久)去连接ZK server. 但是一直连接不上。
+ - 这时 web 上 所有操作均会失败,抛大异常,请求失败,只会重试一次,不会重试多次
+- 后面突然连接上了:
+ - apache ZK client 收到server Expired 消息。
+ - 这时表示会话丢失啦,apache ZK client 自动断开与Server的连接,表示此时让你来处理,因为它不知道应该如何处理。
+ - 这时,disconf-core会reconnect zkserver,重新建立会话。
+ - 成功后,apache ZK client 收到server SyncConnected 消息。表示连接成功
+- 后面又突然连接不上了:
+ - apache ZK client 收到server Disconnected 消息。
+ - 这时,apache ZK client自身会自动(永久)去连接ZK server. 但是一直连接不上。
+ - 这时 web 上 所有操作均会失败,抛大异常,请求失败,只会重试一次,不会重试多次
+
+###服务启动前,zk连接上了:
+
+- 开始连接:
+ - apache ZK client 收到server SyncConnected消息。
+ - 这时所有操作均成功功
+- 后面又突然连接不上了…… (与上面分析一样,此不再赘述)
+
+###注意
+
+ZK一般需要以集群的形式提供出来。假设有N台ZK,
+
+- 只要至少有一台ZK存活,disconf-web就可以正常工作。而且永远不会收到 server Expired 的消息。
+- 只要有一台ZK死亡,disconf-web就会收到 Disconnected 消息。但是系统仍可以继续工作。
+- 如果所有zk都死亡,那么disconf-web会收到 Disconnected 消息。只要有一台存活,disconf-web就会收到
+
+##disconf-client的ZK异常处理##
+
+disconf-client可以完全保证: **如果在启动程序时保证ZK集群是可用的**,那么,就可以保证在任何情况下,与ZK集群的自动连接。
+
+下面按情况进行分析:
+
+###程序启动前,zk连接不上:
+
+这时disconf-client无法在ZK上注册信息。这是必须禁止发生的情况。也是disconf-client无法支持的情况。
+
+一旦发生这种情况,请先恢复ZK集群,再启动你的程序。
+
+###程序启动前,zk连接上了:
+
+如果在程序启动过程中,ZK是正常的,那么,disconf-client可以保证与ZK连接的自动性。
+
+- 只要集群有一台还存活着,你的程序配置还是受disconf托管。
+- 如果集群所有机器均死亡,这时你的程序将游离于disconf之外。只要集群中有任何一台ZK机器重新开启,那么 你的程序将重新 由disconf进行托管。
+
+###注意
+
+disconf-client必须保证在程序在启动时,ZK集群的可用性。
+
+
+
+
diff --git "a/docs/source/design/disconf-client\350\257\246\347\273\206\350\256\276\350\256\241\346\226\207\346\241\243.md" "b/docs/source/design/disconf-client\350\257\246\347\273\206\350\256\276\350\256\241\346\226\207\346\241\243.md"
new file mode 100644
index 000000000..1eba71e7b
--- /dev/null
+++ "b/docs/source/design/disconf-client\350\257\246\347\273\206\350\256\276\350\256\241\346\226\207\346\241\243.md"
@@ -0,0 +1,535 @@
+Disconf-client详细设计文档
+=======
+
+本文档主要阐述了版本 Disconf-Client 的设计。、
+
+## 程序运行流程图 ##
+
+### 版本2.0的设计 ###
+
+![](http://ww3.sinaimg.cn/bmiddle/60c9620fjw1eqi7tnuic8j20l50g7acs.jpg)
+
+[点击查看大图 ](http://ww3.sinaimg.cn/mw1024/60c9620fjw1eqi7tnuic8j20l50g7acs.jpg)
+
+**运行流程详细介绍:**
+
+- **启动事件A**:以下按顺序发生。
+ - A1:扫描静态注解类数据,并注入到配置仓库里。
+ - A2:根据仓库里的配置文件、配置项,到 disconf-web 平台里下载配置数据。
+ - A3:将下载得到的配置数据值注入到仓库里。
+ - A4:根据仓库里的配置文件、配置项,去ZK上监控结点。
+ - A5:根据XML配置定义,到 disconf-web 平台里下载配置文件,放在仓库里,并监控ZK结点。
+ - A6:A1-A5均是处理静态类数据。A6是处理动态类数据,包括:实例化配置的回调函数类;将配置的值注入到配置实体里。
+- **更新配置事件B**:以下按顺序发生。
+ - B1:管理员在 Disconf-web 平台上更新配置。
+ - B2:Disconf-web 平台发送配置更新消息给ZK指定的结点。
+ - B3:ZK通知 Disconf-cient 模块。
+ - B4:与A2一样。唯一不同的是它只处理一个配置文件或者一个配置项,而事件A2则是处理所有配置文件和配置项。下同。
+ - B5:与A3一样。
+ - B6:基本与A4一样,区别是,这里还会将配置的新值注入到配置实体里。
+
+### 完全版的设计 ###
+
+![](http://ww3.sinaimg.cn/bmiddle/60c9620fjw1eqj81no7shj20l50h2q65.jpg)
+
+[点击查看大图 ](http://ww3.sinaimg.cn/mw1024/60c9620fjw1eqj81no7shj20l50h2q65.jpg
+
+**运行流程详细介绍:**
+
+与2.0版本的主要区别是支持了:主备分配功能/主备切换事件。
+
+- **启动事件A**:以下按顺序发生。
+ - A3:扫描静态注解类数据,并注入到配置仓库里。
+ - A4+A2:根据仓库里的配置文件、配置项,去 disconf-web 平台里下载配置数据。这里会有主备竞争
+ - A5:将下载得到的配置数据值注入到仓库里。
+ - A6:根据仓库里的配置文件、配置项,去ZK上监控结点。
+ - A7+A2:根据XML配置定义,到 disconf-web 平台里下载配置文件,放在仓库里,并监控ZK结点。这里会有主备竞争。
+ - A8:A1-A6均是处理静态类数据。A7是处理动态类数据,包括:实例化配置的回调函数类;将配置的值注入到配置实体里。
+- **更新配置事件B**:以下按顺序发生。
+ - B1:管理员在 Disconf-web 平台上更新配置。
+ - B2:Disconf-web 平台发送配置更新消息给ZK指定的结点。
+ - B3:ZK通知 Disconf-cient 模块。
+ - B4:与A4一样。
+ - B5:与A5一样。
+ - B6:基本与A4一样,唯一的区别是,这里还会将配置的新值注入到配置实体里。
+- **主备机切换事件C**:以下按顺序发生。
+ - C1:发生主机挂机事件。
+ - C2:ZK通知所有被影响到的备机。
+ - C4:与A2一样。
+ - C5:与A4一样。
+ - C6:与A5一样。
+ - C7:与A6一样。
+
+## 类设计图 ##
+
+![](http://ww4.sinaimg.cn/bmiddle/60c9620fgw1ej0ycv2fjbj21ao0u8441.jpg)
+
+[查看大图](http://ww4.sinaimg.cn/mw1024/60c9620fgw1ej0ycv2fjbj21ao0u8441.jpg)
+
+**Disconf-client包括的大模块有:**
+
+- scan 配置扫描模块
+- core 配置核心处理模块
+- fetch 配置抓取模块
+- watch 配置监控模块
+- store 配置仓库模块
+- addons 配置reload模块
+
+**各个模块均采用以下设计模式来进设计:**
+
+- 各个模块均以接口的方式对外暴露,松耦合,强内聚
+- 各个模块均提供工厂类由其它模块来进行获取实例,实例的操纵方式均采用接口方式。
+- 对于配置文件和配置项,采用类扩展的方法来避免if else判断。
+
+## Disconf-client 的启动 ##
+
+启动分成两步,由两个Bean来实现
+
+