blob: bfc611f445dd83f7bb02d355ff01ca68a1daf717 [file] [log] [blame]
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Apache Dubbo – Configuration Center</title><link>https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/</link><description>Recent content in Configuration Center on Apache Dubbo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/index.xml" rel="self" type="application/rss+xml"/><item><title>Docs3-V2: Zookeeper</title><link>https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/zookeeper/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/zookeeper/</guid><description>
&lt;h2 id="1-precondition">1 precondition&lt;/h2>
&lt;ul>
&lt;li>Understand &lt;a href="../../../quick-start/spring-boot/">Dubbo basic development steps&lt;/a>&lt;/li>
&lt;li>Install and start &lt;a href="https://zookeeper.apache.org/">Zookeeper&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="2-instructions-for-use">2 Instructions for use&lt;/h2>
&lt;p>View &lt;a href="https://github.com/apache/dubbo-samples/tree/master/3-extensions/configcenter/dubbo-samples-configcenter-annotation">full sample code&lt;/a> here&lt;/p>
&lt;h3 id="21-add-maven-dependency">2.1 Add Maven dependency&lt;/h3>
&lt;p>If the project has enabled Zookeeper as the registry, no additional configuration is required.&lt;/p>
&lt;p>If the Zookeeper registry is not used, please refer to &lt;a href="../../registry/zookeeper/#21-add-maven-dependency">Add Zookeeper-related dependencies for the registry&lt;/a>.&lt;/p>
&lt;h3 id="22-enable-zookeeper-configuration-center">2.2 Enable Zookeeper Configuration Center&lt;/h3>
&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>or&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: zookeeper://127.0.0.1:2181
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&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-properties" data-lang="properties">&lt;span style="display:flex;">&lt;span>dubbo.config-center.address&lt;span style="color:#719e07">=&lt;/span>&lt;span style="color:#2aa198">zookeeper://127.0.0.1:2181&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&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;p>For &lt;code>address&lt;/code> format, please refer to [zookeeper registry - enable configuration](../../registry/zookeeper/#22-configure and enable-zookeeper)&lt;/p>
&lt;h2 id="3-advanced-configuration">3 Advanced configuration&lt;/h2>
&lt;p>To enable authentication, please refer to [zookeeper registry - enable authentication](../../registry/zookeeper/#31-authentication and authentication)&lt;/p>
&lt;h3 id="31-customize-external-configuration-key">3.1 Customize external configuration key&lt;/h3>
&lt;p>&lt;strong>1. Enable external configuration and specify key&lt;/strong>&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: zookeeper://127.0.0.1:2181
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">config-file&lt;/span>: dubbo.properties
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>config-file&lt;/code> - externalized configuration file key value, default &lt;code>dubbo.properties&lt;/code>. &lt;code>config-file&lt;/code> represents the key value corresponding to the file in the configuration center when the Dubbo configuration file is stored in the remote registration center, and it is generally not recommended to modify this configuration item.&lt;/p>
&lt;p>&lt;strong>2. Add configuration to Zookeeper configuration center&lt;/strong>
The storage structure of the externalized configuration is shown in the figure below&lt;/p>
&lt;p>&lt;img src="https://dubbo.apache.org/imgs/user/zk-configcenter.jpg" alt="zk-configcenter.jpg">&lt;/p>
&lt;ul>
&lt;li>namespace, used for environment isolation of different configurations.&lt;/li>
&lt;li>config, a fixed node agreed by Dubbo, cannot be changed, and all configuration and traffic governance rules are stored under this node.&lt;/li>
&lt;li>dubbo and application are used to isolate global configuration and application-level configuration respectively: dubbo is the default group value, and application corresponds to the application name&lt;/li>
&lt;li>dubbo.properties, the node value of this node stores the specific configuration content&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>Here is to explain the working principle, it is recommended to use dubbo-admin for configuration management.&lt;/p>
&lt;/blockquote>
&lt;h3 id="32-set-group-and-namespace">3.2 Set group and namespace&lt;/h3>
&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: zookeeper://127.0.0.1:2181
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">group&lt;/span>: dubbo-cluster1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">namespace&lt;/span>: dev1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For the configuration center, &lt;code>group&lt;/code> and &lt;code>namespace&lt;/code> should be unified across the company (cluster), avoid using different values for different applications, and external configuration and governance rules should also be stored in the corresponding group and namespace.&lt;/p>
&lt;h2 id="4-traffic-governance-rules">4 Traffic Governance Rules&lt;/h2>
&lt;p>All traffic governance rules are stored under the &lt;code>/dubbo/config&lt;/code> node by default. The specific node structure diagram is as follows. It is recommended to add, delete, and modify traffic governance rules through dubbo-admin. For more information, please refer to the specific traffic governance capabilities supported by Dubbo&lt;/p>
&lt;p>&lt;img src="https://dubbo.apache.org/imgs/user/zk-configcenter-governance.jpg" alt="zk-configcenter-governance">&lt;/p>
&lt;ul>
&lt;li>namespace, used for environment isolation of different configurations.&lt;/li>
&lt;li>config, a fixed node agreed by Dubbo, cannot be changed, and all configuration and traffic governance rules are stored under this node.&lt;/li>
&lt;li>dubbo, all service governance rules are global, dubbo is the default node&lt;/li>
&lt;li>configurators/tag-router/condition-router/migration, different service governance rule types, node value stores specific rule content&lt;/li>
&lt;/ul></description></item><item><title>Docs3-V2: Nacos</title><link>https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/nacos/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/nacos/</guid><description>
&lt;h2 id="1-precondition">1 precondition&lt;/h2>
&lt;ul>
&lt;li>Understand &lt;a href="../../../quick-start/spring-boot/">Dubbo basic development steps&lt;/a>&lt;/li>
&lt;li>Install and start &lt;a href="https://nacos.io/zh-cn/docs/quick-start.html">Nacos&lt;/a>&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>When Dubbo uses &lt;code>3.0.0&lt;/code> and above, it needs to use Nacos &lt;code>2.0.0&lt;/code> and above.&lt;/p>
&lt;/blockquote>
&lt;h2 id="2-instructions-for-use">2 Instructions for use&lt;/h2>
&lt;h3 id="21-add-maven-dependency">2.1 Add Maven dependency&lt;/h3>
&lt;p>If the project has enabled Nacos as the registration center, no additional configuration is required.&lt;/p>
&lt;p>If the Nacos registry is not enabled, please refer to [Adding Nacos dependencies to the registry](../../registry/nacos/#21-Add dependencies).&lt;/p>
&lt;h3 id="22-enable-nacos-configuration-center">2.2 Enable Nacos Configuration Center&lt;/h3>
&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;nacos://127.0.0.1:8848&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>or&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: nacos://127.0.0.1:8848
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&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-properties" data-lang="properties">&lt;span style="display:flex;">&lt;span>dubbo.config-center.address&lt;span style="color:#719e07">=&lt;/span>&lt;span style="color:#2aa198">nacos://127.0.0.1:8848&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&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;nacos://127.0.0.1:8848&amp;#34;&lt;/span>&lt;span style="color:#719e07">);&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For &lt;code>address&lt;/code> format, please refer to [Nacos Registry - Enable Configuration](../../registry/nacos/#22-configure and enable-nacos)&lt;/p>
&lt;h2 id="3-advanced-configuration">3 Advanced configuration&lt;/h2>
&lt;p>To enable authentication authentication, please refer to &lt;a href="../../registry/nacos/#31-authentication">Nacos Registry - Enable Authentication Authentication&lt;/a>&lt;/p>
&lt;h3 id="31-external-configuration">3.1 External configuration&lt;/h3>
&lt;h4 id="311-global-externalization-configuration">3.1.1 Global externalization configuration&lt;/h4>
&lt;p>&lt;strong>1. The application opens config-center configuration&lt;/strong>&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: nacos://127.0.0.1:2181
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">config-file&lt;/span>: dubbo.properties &lt;span style="color:#586e75"># optional&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>config-file&lt;/code> - global externalized configuration file key value, default &lt;code>dubbo.properties&lt;/code>. &lt;code>config-file&lt;/code> represents the key value corresponding to the file in the configuration center when the Dubbo configuration file is stored in the remote registration center, and it is generally not recommended to modify this configuration item.&lt;/p>
&lt;p>&lt;strong>2. Add configuration to Nacos Server&lt;/strong>&lt;/p>
&lt;p>&lt;img src="https://dubbo.apache.org/imgs/user/nacos-configcenter-global-properties.png" alt="nacos-configcenter-global-properties.png">&lt;/p>
&lt;p>dataId is &lt;code>dubbo.properties&lt;/code>, group grouping is consistent with config-center, if not set, &lt;code>dubbo&lt;/code> will be filled by default.&lt;/p>
&lt;h4 id="312-application-specific-externalization-configuration">3.1.2 Application-specific externalization configuration&lt;/h4>
&lt;p>&lt;strong>1. The application opens config-center configuration&lt;/strong>&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: nacos://127.0.0.1:2181
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">app-config-file&lt;/span>: dubbo.properties &lt;span style="color:#586e75"># optional&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;code>app-config-file&lt;/code> - The current application-specific externalization configuration file key value, such as &lt;code>app-name-dubbo.properties&lt;/code>, only configured when it needs to override the global externalization configuration file &lt;code>config-file&lt;/code>.&lt;/p>
&lt;p>&lt;strong>2. Add configuration to Nacos Server&lt;/strong>&lt;/p>
&lt;p>&lt;img src="https://dubbo.apache.org/imgs/user/nacos-configcenter-application-properties.png" alt="nacos-configcenter-application-properties.png">&lt;/p>
&lt;p>The dataId is &lt;code>dubbo.properties&lt;/code>, and the group is set to the application name, namely &lt;code>demo-provider&lt;/code>.&lt;/p>
&lt;h3 id="32-set-group-and-namespace">3.2 Set group and namespace&lt;/h3>
&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: zookeeper://127.0.0.1:2181
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">group&lt;/span>: dubbo-cluster1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">namespace&lt;/span>: dev1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>For the configuration center, &lt;code>group&lt;/code> and &lt;code>namespace&lt;/code> should be unified across the company (cluster), and different applications should be prevented from using different values.&lt;/p>
&lt;h3 id="33-nacos-extended-configuration">3.3 Nacos extended configuration&lt;/h3>
&lt;p>For more parameter configurations supported by Nacos sdk/server, please refer to [Nacos Registry - More Configurations](../../registry/nacos/#35-More Configurations)&lt;/p>
&lt;h2 id="4-traffic-governance-rules">4 Traffic Governance Rules&lt;/h2>
&lt;p>For Nacos, all traffic governance rules and external configurations should be globally visible, so applications in the same logical cluster must use the same namespace and group. Among them, the default value of namespace is &lt;code>public&lt;/code>, and the default value of group is &lt;code>dubbo&lt;/code>. The application should not modify the namespace and group without authorization, unless it can maintain global consistency.&lt;/p>
&lt;p>It is recommended to add, delete, and modify traffic governance rules through dubbo-admin. For more information, please refer to the traffic governance capabilities supported by Dubbo.&lt;/p>
&lt;p>&lt;img src="https://dubbo.apache.org/imgs/user/nacos-configcenter-governance.png" alt="nacos-configcenter-governance.jpg">&lt;/p>
&lt;p>There are many types of traffic governance rules, and the suffixes of dataId for different types of rules are different:&lt;/p>
&lt;ul>
&lt;li>configurators, &lt;a href="https://dubbo.apache.org/zh-cn/overview/core-features/traffic/configuration-rule/">override rules&lt;/a>&lt;/li>
&lt;li>tag-router, &lt;a href="https://dubbo.apache.org/zh-cn/overview/core-features/traffic/tag-rule/">tag routing&lt;/a>&lt;/li>
&lt;li>condition-router, &lt;a href="https://dubbo.apache.org/zh-cn/overview/core-features/traffic/condition-rule/">conditional routing&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Docs3-V2: Apollo</title><link>https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/apollo/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/config-center/apollo/</guid><description>
&lt;h2 id="1-precondition">1 precondition&lt;/h2>
&lt;ul>
&lt;li>Understand &lt;a href="../../../quick-start/spring-boot/">Dubbo basic development steps&lt;/a>&lt;/li>
&lt;li>Install and start &lt;a href="https://www.apolloconfig.com/#/zh/README">Apollo&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="2-instructions-for-use">2 Instructions for use&lt;/h2>
&lt;p>Check here &lt;a href="https://github.com/apache/dubbo-samples/tree/master/3-extensions/configcenter/dubbo-samples-configcenter-apollo">full sample code&lt;/a>&lt;/p>
&lt;h3 id="21-add-maven-dependency">2.1 Add Maven dependency&lt;/h3>
&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;dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;groupId&amp;gt;&lt;/span>org.apache.dubbo&lt;span style="color:#268bd2">&amp;lt;/groupId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;artifactId&amp;gt;&lt;/span>dubbo&lt;span style="color:#268bd2">&amp;lt;/artifactId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;version&amp;gt;&lt;/span>3.0.9&lt;span style="color:#268bd2">&amp;lt;/version&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;/dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;groupId&amp;gt;&lt;/span>com.ctrip.framework.apollo&lt;span style="color:#268bd2">&amp;lt;/groupId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;artifactId&amp;gt;&lt;/span>apollo-openapi&lt;span style="color:#268bd2">&amp;lt;/artifactId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;version&amp;gt;&lt;/span>2.0.0&lt;span style="color:#268bd2">&amp;lt;/version&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;/dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;groupId&amp;gt;&lt;/span>com.ctrip.framework.apollo&lt;span style="color:#268bd2">&amp;lt;/groupId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;artifactId&amp;gt;&lt;/span>apollo-client&lt;span style="color:#268bd2">&amp;lt;/artifactId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;version&amp;gt;&lt;/span>2.0.0&lt;span style="color:#268bd2">&amp;lt;/version&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;/dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="22-enable-apollo-configuration-center">2.2 Enable Apollo Configuration Center&lt;/h3>
&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;apollo://localhost:8080&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>or&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-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>dubbo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> config-center
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">address&lt;/span>: apollo://localhost:8080
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&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-properties" data-lang="properties">&lt;span style="display:flex;">&lt;span>dubbo.config-center.address&lt;span style="color:#719e07">=&lt;/span>&lt;span style="color:#2aa198">apollo://localhost:8080&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&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;apollo://localhost:8080&amp;#34;&lt;/span>&lt;span style="color:#719e07">);&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="3-advanced-configuration">3 Advanced configuration&lt;/h2>
&lt;p>A core concept in Apollo is the namespace - namespace, which is different from the namespace concepts of Zookeeper and Nacos above, so the usage method is also special. It is recommended to read the following documents after fully understanding the usage of Apollo itself.&lt;/p>
&lt;p>But in general, for the adaptation of Apollo:&lt;/p>
&lt;ul>
&lt;li>namespace is specially used for isolation of traffic governance rules, see 3.1&lt;/li>
&lt;li>group is specially used for isolation of externalized configuration, see 3.2&lt;/li>
&lt;/ul>
&lt;h3 id="31-external-configuration">3.1 External configuration&lt;/h3>
&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> group=&lt;span style="color:#2aa198">&amp;#34;demo-provider&amp;#34;&lt;/span> address=&lt;span style="color:#2aa198">&amp;#34;apollo://localhost:8080&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>The &lt;code>group&lt;/code> of config-center determines where Apollo reads the externalized configuration &lt;code>dubbo.properties&lt;/code> file:&lt;/p>
&lt;ol>
&lt;li>If the group is empty, the configuration will be read from the &lt;code>dubbo&lt;/code> namespace by default, and the user must write the externalized configuration under the &lt;code>dubbo&lt;/code> namespace.&lt;/li>
&lt;li>If group is not empty
2.1 If the group value is the application name, the configuration is read from the current namespace of the application, and the user must write the externalized configuration under the default namespace of the application automatically designated by Apollo.
2.2 If the group value is any value, the configuration is read from the corresponding namespace, and the user must write the externalized configuration under the namespace.&lt;/li>
&lt;/ol>
&lt;p>For example, the following example uses the default global externalization configuration of group=&amp;lsquo;dubbo&amp;rsquo;, that is, the configuration can be read by all applications.
&lt;img src="https://dubbo.apache.org/imgs/user/apollo-configcenter-dubbo.png" alt="apollo-configcenter-dubbo.png">&lt;/p>
&lt;p>If the configuration group=&amp;lsquo;application name&amp;rsquo; is an application-specific configuration, only this application can read it.&lt;/p>
&lt;blockquote>
&lt;p>Regarding externalized file configuration hosting, it is equivalent to storing the contents of the &lt;code>dubbo.properties&lt;/code> configuration file in Apollo. Each application can inherit the public configuration by associating with the shared &lt;code>dubbo&lt;/code> namespace, and then can override individual configuration items individually.&lt;/p>
&lt;/blockquote>
&lt;h3 id="32-traffic-governance-rules">3.2 Traffic Governance Rules&lt;/h3>
&lt;p>**Traffic governance rules must be shared globally, so the namespace configuration in each application should be consistent. **&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> namespace=&lt;span style="color:#2aa198">&amp;#34;governance&amp;#34;&lt;/span> address=&lt;span style="color:#2aa198">&amp;#34;apollo://localhost:8080&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>The &lt;code>namespace&lt;/code> of config-center determines where Apollo accesses &lt;code>traffic governance rules&lt;/code>:&lt;/p>
&lt;ol>
&lt;li>If the namespace is empty, the configuration will be accessed from the &lt;code>dubbo&lt;/code> namespace by default, and the governance rules must be written under the &lt;code>dubbo&lt;/code> namespace.&lt;/li>
&lt;li>If the namespace is not empty, read the rules from the corresponding namespace value, and the governance rules must be written under this namespace.&lt;/li>
&lt;/ol>
&lt;p>For example, the following example puts the traffic governance rules under the &lt;code>governance&lt;/code> namespace through &lt;code>namespace='governance'&lt;/code>.
&lt;img src="https://dubbo.apache.org/imgs/user/apollo-configcenter-governance-dubbo.png" alt="apollo-configcenter-governance-dubbo.png">&lt;/p>
&lt;h3 id="33-more-apollo-specific-configurations">3.3 More Apollo-specific configurations&lt;/h3>
&lt;p>Currently Dubbo is adapted to env, apollo.meta, apollo.cluster, apollo.id and other unique configuration items, which can be configured through the extended parameters of config-center.&lt;/p>
&lt;p>Such as&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-properties" data-lang="properties">&lt;span style="display:flex;">&lt;span>dubbo.config-center.address&lt;span style="color:#719e07">=&lt;/span>&lt;span style="color:#2aa198">apollo://localhost:8080&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>or&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-properties" data-lang="properties">&lt;span style="display:flex;">&lt;span>dubbo.config-center.prameters.apollo.meta&lt;span style="color:#719e07">=&lt;/span>&lt;span style="color:#2aa198">xxx&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>dubbo.config-center.prameters.env&lt;span style="color:#719e07">=&lt;/span>&lt;span style="color:#2aa198">xxx&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item></channel></rss>