You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2021/08/13 14:11:52 UTC

[shardingsphere] branch master updated: Update governance jdbc yaml file (#11813)

This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new e2483a7  Update governance jdbc yaml file (#11813)
e2483a7 is described below

commit e2483a7a385f36c2c479d184a8d4ae0f38b22795
Author: Liang Zhang <te...@163.com>
AuthorDate: Fri Aug 13 22:11:26 2021 +0800

    Update governance jdbc yaml file (#11813)
---
 .../META-INF/zookeeper/cloud/encrypt.yaml          | 10 ++++---
 .../zookeeper/cloud/readwrite-splitting.yaml       | 10 ++++---
 .../resources/META-INF/zookeeper/cloud/shadow.yaml | 10 ++++---
 .../zookeeper/cloud/sharding-databases-tables.yaml | 10 ++++---
 .../META-INF/zookeeper/local/encrypt.yaml          | 10 ++++---
 .../zookeeper/local/readwrite-splitting.yaml       | 10 ++++---
 .../resources/META-INF/zookeeper/local/shadow.yaml | 10 ++++---
 .../zookeeper/local/sharding-databases-tables.yaml | 10 ++++---
 .../config/pojo/YamlRootRuleConfigurations.java    |  7 +++--
 ...lGovernanceShardingSphereDataSourceFactory.java | 34 +++++++++++-----------
 ...gWithReadwriteSplittingDataSourceWithProps.yaml |  9 +++---
 ...thReadwriteSplittingDataSourceWithoutProps.yaml |  9 +++---
 .../sharding/configWithDataSourceWithProps.yaml    |  9 +++---
 .../sharding/configWithDataSourceWithoutProps.yaml |  9 +++---
 .../sharding/configWithoutDataSourceWithProps.yaml |  9 +++---
 .../configWithoutDataSourceWithoutProps.yaml       |  9 +++---
 .../configWithDataSourceWithProps.yaml             |  9 +++---
 .../configWithDataSourceWithoutProps.yaml          |  9 +++---
 .../configWithDataSourceWithoutRules.yaml          |  9 +++---
 .../configWithoutDataSourceWithProps.yaml          |  9 +++---
 .../configWithoutDataSourceWithoutProps.yaml       |  9 +++---
 .../src/test/resources/yaml/unit/sharding.yaml     | 10 ++++---
 .../resources/env/sharding_governance/rules.yaml   |  8 +++--
 23 files changed, 136 insertions(+), 102 deletions(-)

diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml
index 97f8cc1..1b4ffc4 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/encrypt.yaml
@@ -15,9 +15,11 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_ds_encrypt
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_ds_encrypt
+      serverLists: localhost:2181
   overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/readwrite-splitting.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/readwrite-splitting.yaml
index 3693ed7..353af75 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/readwrite-splitting.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/readwrite-splitting.yaml
@@ -15,9 +15,11 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_pr_ds
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_pr_ds
+      serverLists: localhost:2181
   overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml
index 0bb9610..d435f90 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/shadow.yaml
@@ -15,9 +15,11 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_ds_shadow
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_ds_shadow
+      serverLists: localhost:2181
   overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml
index e463658..095c1ea 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/cloud/sharding-databases-tables.yaml
@@ -15,9 +15,11 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_ds_sharding
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_ds_sharding
+      serverLists: localhost:2181
   overwrite: false
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml
index afee643..d35a041 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/encrypt.yaml
@@ -15,11 +15,13 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_ds_encrypt
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_ds_encrypt
+      serverLists: localhost:2181
   overwrite: true
 
 dataSources:
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/readwrite-splitting.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/readwrite-splitting.yaml
index f98a037..cb0e1be 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/readwrite-splitting.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/readwrite-splitting.yaml
@@ -15,11 +15,13 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_pr_ds
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_pr_ds
+      serverLists: localhost:2181
   overwrite: true
 
 dataSources:
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
index 9625b85..d7184ea 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/shadow.yaml
@@ -15,11 +15,13 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_ds_shadow
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_ds_shadow
+      serverLists: localhost:2181
   overwrite: true
 
 dataSources:
diff --git a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml
index 05f6bf1..fa1531f 100644
--- a/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml
+++ b/examples/shardingsphere-jdbc-example/governance-example/governance-raw-jdbc-example/src/main/resources/META-INF/zookeeper/local/sharding-databases-tables.yaml
@@ -15,11 +15,13 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: demo_yaml_ds_sharding
-    serverLists: localhost:2181
+    props:
+      namespace: demo_yaml_ds_sharding
+      serverLists: localhost:2181
   overwrite: true
 
 dataSources:
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/YamlRootRuleConfigurations.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/YamlRootRuleConfigurations.java
index 977aea3..3d55356 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/YamlRootRuleConfigurations.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/yaml/config/pojo/YamlRootRuleConfigurations.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.infra.yaml.config.pojo;
 
 import lombok.Getter;
 import lombok.Setter;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -33,11 +34,13 @@ import java.util.Properties;
 @Setter
 public class YamlRootRuleConfigurations implements YamlConfiguration {
     
+    private String schemaName;
+    
     private Map<String, Map<String, Object>> dataSources = new HashMap<>();
     
     private Collection<YamlRuleConfiguration> rules = new LinkedList<>();
     
-    private Properties props = new Properties();
+    private YamlModeConfiguration mode;
     
-    private String schemaName;
+    private Properties props = new Properties();
 }
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/api/yaml/YamlGovernanceShardingSphereDataSourceFactory.java b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/api/yaml/YamlGovernanceShardingSphereDataSourceFactory.java
index b25cbc7..69ba5ff 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/api/yaml/YamlGovernanceShardingSphereDataSourceFactory.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/main/java/org/apache/shardingsphere/driver/governance/api/yaml/YamlGovernanceShardingSphereDataSourceFactory.java
@@ -21,15 +21,14 @@ import com.google.common.base.Strings;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.driver.governance.internal.datasource.GovernanceShardingSphereDataSource;
-import org.apache.shardingsphere.driver.governance.internal.util.YamlGovernanceConfigurationSwapperUtil;
 import org.apache.shardingsphere.driver.governance.internal.yaml.YamlGovernanceRootRuleConfigurations;
-import org.apache.shardingsphere.governance.core.yaml.pojo.YamlGovernanceConfiguration;
-import org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.infra.database.DefaultSchema;
 import org.apache.shardingsphere.infra.mode.config.ModeConfiguration;
+import org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
 import org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
+import org.apache.shardingsphere.infra.yaml.config.swapper.mode.ModeConfigurationYamlSwapper;
 import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
 
 import javax.sql.DataSource;
@@ -56,7 +55,7 @@ public final class YamlGovernanceShardingSphereDataSourceFactory {
      */
     public static DataSource createDataSource(final File yamlFile) throws SQLException, IOException {
         YamlGovernanceRootRuleConfigurations configs = unmarshal(yamlFile);
-        return createDataSource(configs.getSchemaName(), new YamlDataSourceConfigurationSwapper().swapToDataSources(configs.getDataSources()), configs, configs.getProps(), configs.getGovernance());
+        return createDataSource(configs.getSchemaName(), new YamlDataSourceConfigurationSwapper().swapToDataSources(configs.getDataSources()), configs, configs.getProps(), configs.getMode());
     }
     
     /**
@@ -70,7 +69,7 @@ public final class YamlGovernanceShardingSphereDataSourceFactory {
      */
     public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException {
         YamlGovernanceRootRuleConfigurations configs = unmarshal(yamlFile);
-        return createDataSource(configs.getSchemaName(), dataSourceMap, configs, configs.getProps(), configs.getGovernance());
+        return createDataSource(configs.getSchemaName(), dataSourceMap, configs, configs.getProps(), configs.getMode());
     }
     
     /**
@@ -83,7 +82,7 @@ public final class YamlGovernanceShardingSphereDataSourceFactory {
      */
     public static DataSource createDataSource(final byte[] yamlBytes) throws SQLException, IOException {
         YamlGovernanceRootRuleConfigurations configs = unmarshal(yamlBytes);
-        return createDataSource(configs.getSchemaName(), new YamlDataSourceConfigurationSwapper().swapToDataSources(configs.getDataSources()), configs, configs.getProps(), configs.getGovernance());
+        return createDataSource(configs.getSchemaName(), new YamlDataSourceConfigurationSwapper().swapToDataSources(configs.getDataSources()), configs, configs.getProps(), configs.getMode());
     }
     
     /**
@@ -97,31 +96,32 @@ public final class YamlGovernanceShardingSphereDataSourceFactory {
      */
     public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final byte[] yamlBytes) throws SQLException, IOException {
         YamlGovernanceRootRuleConfigurations configs = unmarshal(yamlBytes);
-        return createDataSource(configs.getSchemaName(), dataSourceMap, configs, configs.getProps(), configs.getGovernance());
+        return createDataSource(configs.getSchemaName(), dataSourceMap, configs, configs.getProps(), configs.getMode());
     }
     
     private static DataSource createDataSource(final String schemaName, final Map<String, DataSource> dataSourceMap, final YamlGovernanceRootRuleConfigurations configs,
-                                               final Properties props, final YamlGovernanceConfiguration governance) throws SQLException {
+                                               final Properties props, final YamlModeConfiguration yamlModeConfig) throws SQLException {
         if (configs.getRules().isEmpty() || dataSourceMap.isEmpty()) {
-            return createDataSourceWithoutRules(schemaName, governance);
-        } else {
-            return createDataSourceWithRules(schemaName, dataSourceMap, new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(configs.getRules()), props, governance);
+            return createDataSourceWithoutRules(schemaName, yamlModeConfig);
         }
+        return createDataSourceWithRules(schemaName, dataSourceMap, new YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(configs.getRules()), props, yamlModeConfig);
     }
     
-    private static DataSource createDataSourceWithoutRules(final String schemaName, final YamlGovernanceConfiguration governance) throws SQLException {
-        GovernanceConfiguration governanceConfig = YamlGovernanceConfigurationSwapperUtil.marshal(governance);
-        ModeConfiguration modeConfig = new ModeConfiguration("Cluster", governanceConfig.getRegistryCenterConfiguration(), governanceConfig.isOverwrite());
+    private static DataSource createDataSourceWithoutRules(final String schemaName, final YamlModeConfiguration yamlModeConfig) throws SQLException {
+        ModeConfiguration modeConfig = getModeConfiguration(yamlModeConfig);
         return new GovernanceShardingSphereDataSource(Strings.isNullOrEmpty(schemaName) ? DefaultSchema.LOGIC_NAME : schemaName, modeConfig);
     }
     
     private static DataSource createDataSourceWithRules(final String schemaName, final Map<String, DataSource> dataSourceMap, 
-                                                        final Collection<RuleConfiguration> ruleConfigs, final Properties props, final YamlGovernanceConfiguration governance) throws SQLException {
-        GovernanceConfiguration governanceConfig = YamlGovernanceConfigurationSwapperUtil.marshal(governance);
-        ModeConfiguration modeConfig = new ModeConfiguration("Cluster", governanceConfig.getRegistryCenterConfiguration(), governanceConfig.isOverwrite());
+                                                        final Collection<RuleConfiguration> ruleConfigs, final Properties props, final YamlModeConfiguration yamlModeConfig) throws SQLException {
+        ModeConfiguration modeConfig = getModeConfiguration(yamlModeConfig);
         return new GovernanceShardingSphereDataSource(Strings.isNullOrEmpty(schemaName) ? DefaultSchema.LOGIC_NAME : schemaName, dataSourceMap, ruleConfigs, props, modeConfig);
     }
     
+    private static ModeConfiguration getModeConfiguration(final YamlModeConfiguration yamlModeConfig) {
+        return null == yamlModeConfig ? new ModeConfiguration("Memory", null, true) : new ModeConfigurationYamlSwapper().swapToObject(yamlModeConfig);
+    }
+    
     private static YamlGovernanceRootRuleConfigurations unmarshal(final File yamlFile) throws IOException {
         return YamlEngine.unmarshal(yamlFile, YamlGovernanceRootRuleConfigurations.class);
     }
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithProps.yaml
index e219b44..3ce9ff5 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithProps.yaml
@@ -47,12 +47,13 @@ rules:
         - read_ds_0
         - read_ds_1
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_rw_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_rw_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithoutProps.yaml
index dc18634..21d4a6f 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/readwrite_splitting/configWithReadwriteSplittingDataSourceWithoutProps.yaml
@@ -47,12 +47,13 @@ rules:
         - read_ds_0
         - read_ds_1
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_rw_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_rw_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
index 69d12f1..a8f1b99 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
@@ -88,12 +88,13 @@ rules:
     increment:
       type: INCREMENT
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
index bf8772c..0830440 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
@@ -86,12 +86,13 @@ rules:
     increment:
       type: INCREMENT
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
index 7aa45df..cd00b79 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
@@ -68,12 +68,13 @@ rules:
     increment:
       type: INCREMENT
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
index 136a004..16e2861 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
@@ -70,12 +70,13 @@ rules:
     increment:
       type: INCREMENT
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithProps.yaml
index e09e2ea..eca02bd 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithProps.yaml
@@ -122,12 +122,13 @@ rules:
     roundRobin:
       type: ROUND_ROBIN
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_ms_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_ms_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutProps.yaml
index 57d0e28..de7338e 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutProps.yaml
@@ -124,12 +124,13 @@ rules:
     roundRobin:
       type: ROUND_ROBIN
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_ms_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_ms_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutRules.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutRules.yaml
index 51f200e..1cb9e2a 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutRules.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithDataSourceWithoutRules.yaml
@@ -45,12 +45,13 @@ dataSources:
     password: 
     maxTotal: 100
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_ms_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_ms_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithProps.yaml
index 359a28b..5b38ba8 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithProps.yaml
@@ -82,12 +82,13 @@ rules:
       readDataSourceNames:
         - read_ds_1
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_ms_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_ms_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithoutProps.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithoutProps.yaml
index c849863..d810d37 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithoutProps.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/integrate/sharding_readwrite_splitting/configWithoutDataSourceWithoutProps.yaml
@@ -85,12 +85,13 @@ rules:
     roundRobin:
       type: ROUND_ROBIN
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_sharding_ms_registry_name
-    serverLists: localhost:3181
     props:
+      namespace: test_sharding_ms_registry_name
+      serverLists: localhost:3181
       retryIntervalMilliseconds: 10
       timeToLiveSeconds: 10
       maxRetries: 10
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml
index f67d585..6d4f50e 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/resources/yaml/unit/sharding.yaml
@@ -15,11 +15,13 @@
 # limitations under the License.
 #
 
-governance:
-  registryCenter:
+mode:
+  type: Cluster
+  repository:
     type: GOV_TEST
-    namespace: test_name
-    serverLists: localhost:3181
+    props:
+      namespace: test_name
+      serverLists: localhost:3181
   overwrite: true
 
 dataSources:
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/sharding_governance/rules.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/sharding_governance/rules.yaml
index 62cf393..b02e1ad 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/sharding_governance/rules.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/sharding_governance/rules.yaml
@@ -14,11 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-governance:
-  registryCenter:
+
+mode:
+  type: Cluster
+  repository:
     type: ZooKeeper
-    namespace: governance_ds
     props:
+      namespace: governance_ds
       retryIntervalMilliseconds: 500
       timeToLiveSeconds: 60
       maxRetries: 3