<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Apache Dubbo – 配置中心参考手册</title><link>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/</link><description>Recent content in 配置中心参考手册 on Apache Dubbo</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/index.xml" rel="self" type="application/rss+xml"/><item><title>Java-Sdk: 配置中心概述</title><link>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/overview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/overview/</guid><description>
&lt;p>配置中心在 Dubbo 中承担3个职责：&lt;/p>
&lt;ol>
&lt;li>外部化配置：启动配置的集中式存储 （简单理解为 dubbo.properties 的外部化存储）。&lt;/li>
&lt;li>服务治理：服务治理规则的存储与通知。&lt;/li>
&lt;li>动态配置：控制动态开关或者动态变更属性值&lt;/li>
&lt;/ol>
&lt;p>启用动态配置，以 Zookeeper 为例，可查看 &lt;a href="../../references/xml/dubbo-config-center">配置中心属性详解&lt;/a>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-xml" data-lang="xml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;dubbo:config-center&lt;/span> address=&lt;span style="color:#2aa198">&amp;#34;zookeeper://127.0.0.1:2181&amp;#34;&lt;/span>&lt;span style="color:#268bd2">/&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>或者&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span>dubbo.config-center.address=zookeeper://127.0.0.1:2181
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>或者&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-java" data-lang="java">&lt;span style="display:flex;">&lt;span>ConfigCenterConfig configCenter &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#719e07">new&lt;/span> ConfigCenterConfig&lt;span style="color:#719e07">();&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>configCenter&lt;span style="color:#719e07">.&lt;/span>setAddress&lt;span style="color:#719e07">(&lt;/span>&lt;span style="color:#2aa198">&amp;#34;zookeeper://127.0.0.1:2181&amp;#34;&lt;/span>&lt;span style="color:#719e07">);&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;blockquote>
&lt;p>为了兼容 2.6.x 版本配置，在使用 Zookeeper 作为注册中心，且没有显示配置配置中心的情况下，Dubbo 框架会默认将此 Zookeeper 用作配置中心，但将只作服务治理用途。&lt;/p>
&lt;/blockquote>
&lt;h2 id="外部化配置">外部化配置&lt;/h2>
&lt;p>请参考文档 &lt;a href="../configuration/external-config">外部化配置&lt;/a>&lt;/p>
&lt;h2 id="动态配置">动态配置&lt;/h2>
&lt;p>[TODO 待完善]&lt;/p>
&lt;h2 id="服务治理">服务治理&lt;/h2>
&lt;h4 id="zookeeper">Zookeeper&lt;/h4>
&lt;p>默认节点结构：&lt;/p>
&lt;p>&lt;img src="https://chickenlj.github.io/incubator-dubbo-website/imgs/user/zk-configcenter-governance.jpg" alt="zk-configcenter-governance">&lt;/p>
&lt;ul>
&lt;li>namespace，用于不同配置的环境隔离。&lt;/li>
&lt;li>config，Dubbo 约定的固定节点，不可更改，所有配置和服务治理规则都存储在此节点下。&lt;/li>
&lt;li>dubbo，所有服务治理规则都是全局性的，dubbo 为默认节点&lt;/li>
&lt;li>configurators/tag-router/condition-router/migration，不同的服务治理规则类型，node value 存储具体规则内容&lt;/li>
&lt;/ul>
&lt;h4 id="apollo">Apollo&lt;/h4>
&lt;p>所有的服务治理规则都是全局性的，默认从公共命名空间 &lt;code>dubbo&lt;/code> 读取和订阅：&lt;/p>
&lt;p>&lt;img src="https://chickenlj.github.io/incubator-dubbo-website/imgs/user/apollo-configcenter-governance.jpg" alt="apollo-configcenter-governance.jpg">&lt;/p>
&lt;p>不同的规则以不同的 key 后缀区分：&lt;/p>
&lt;ul>
&lt;li>configurators，&lt;a href="../../examples/config-rule">覆盖规则&lt;/a>&lt;/li>
&lt;li>tag-router，&lt;a href="../../examples/routing-rule">标签路由&lt;/a>&lt;/li>
&lt;li>condition-router，&lt;a href="../../examples/condition-router">条件路由&lt;/a>&lt;/li>
&lt;li>migration, &lt;a href="../../examples/todo">迁移规则&lt;/a>&lt;/li>
&lt;/ul>
&lt;h4 id="nacos">Nacos&lt;/h4>
&lt;p>所有的服务治理规则都是全局的，默认从 namespace: &lt;code>public&lt;/code> 下进行读取， 通过 dataId: &lt;code>interface name&lt;/code> 以及 group: &lt;code>dubbo&lt;/code> 去读取和订阅：&lt;/p>
&lt;p>&lt;img src="https://chickenlj.github.io/incubator-dubbo-website/imgs/user/nacos-configcenter-governance.png" alt="nacos-configcenter-governance.jpg">&lt;/p>
&lt;p>不同的规则以 dataId 的后缀区分：&lt;/p>
&lt;ul>
&lt;li>configurators，&lt;a href="../../examples/config-rule">覆盖规则&lt;/a>&lt;/li>
&lt;li>tag-router，&lt;a href="../../examples/routing-rule">标签路由&lt;/a>&lt;/li>
&lt;li>condition-router，&lt;a href="../../examples/condition-router">条件路由&lt;/a>&lt;/li>
&lt;li>migration, &lt;a href="../../examples/todo">迁移规则&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Java-Sdk: Zookeeper</title><link>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/zookeeper/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/zookeeper/</guid><description/></item><item><title>Java-Sdk: Nacos</title><link>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/nacos/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/nacos/</guid><description/></item><item><title>Java-Sdk: Apollo</title><link>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/apollo/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://chickenlj.github.io/incubator-dubbo-website/cn/java-sdk/reference-manual/config-center/apollo/</guid><description/></item></channel></rss>