You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2021/01/28 07:07:12 UTC

[shardingsphere] branch master updated: Refactor scaling ServerConfiguration (#9200)

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

menghaoran 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 82e09d8  Refactor scaling ServerConfiguration (#9200)
82e09d8 is described below

commit 82e09d81c730042db09e16fcc9fe055c3f4fb0c3
Author: 邱鹿 Lucas <lu...@163.com>
AuthorDate: Thu Jan 28 15:06:40 2021 +0800

    Refactor scaling ServerConfiguration (#9200)
    
    * Refactor scaling ServerConfiguration
    
    * update server.yaml
    
    Co-authored-by: qiulu3 <Lucas209910>
---
 .../src/main/resources/conf/server.yaml            | 11 ++---
 .../impl/GovernanceBootstrapInitializer.java       |  2 +-
 .../src/main/resources/conf/server.yaml            | 11 ++---
 .../scaling/core/config/ServerConfiguration.java   |  2 +-
 .../datasource/ConfigurationYamlConverter.java     |  2 +
 .../DataSourceConfigurationYamlSwapper.java        | 42 ------------------
 .../datasource/YamlDataSourceConfiguration.java    | 37 ----------------
 .../YamlDataSourceConfigurationWrap.java           | 33 --------------
 .../GovernanceCenterConfigurationYamlSwapper.java  | 41 -----------------
 .../yaml/GovernanceConfigurationYamlSwapper.java   | 51 ----------------------
 .../yaml/ServerConfigurationYamlSwapper.java       | 21 ++++-----
 .../yaml/YamlGovernanceCenterConfiguration.java    | 38 ----------------
 .../config/yaml/YamlGovernanceConfiguration.java   | 38 ----------------
 .../core/config/yaml/YamlServerConfiguration.java  | 16 +++++--
 .../core/service/RegistryRepositoryHolder.java     |  2 +-
 .../scaling/core/spi/ScalingWorkerLoader.java      |  2 +-
 .../impl/DistributedScalingJobServiceTest.java     |  2 +-
 17 files changed, 42 insertions(+), 309 deletions(-)

diff --git a/shardingsphere-distribution/shardingsphere-scaling-distribution/src/main/resources/conf/server.yaml b/shardingsphere-distribution/shardingsphere-scaling-distribution/src/main/resources/conf/server.yaml
index 678ba4d..7629c89 100644
--- a/shardingsphere-distribution/shardingsphere-scaling-distribution/src/main/resources/conf/server.yaml
+++ b/shardingsphere-distribution/shardingsphere-scaling-distribution/src/main/resources/conf/server.yaml
@@ -15,12 +15,13 @@
 # limitations under the License.
 #
 
-port: 8888
-blockQueueSize: 10000
-workerThread: 30
+scaling:
+  port: 8888
+  blockQueueSize: 10000
+  workerThread: 30
 
-#distributedScalingService:
-#  name: ScalingJob
+#governance:
+#  name: governance_ds
 #  registryCenter:
 #    type: ZooKeeper
 #    serverLists: localhost:2181
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
index b7410ab..80f87fc 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/initializer/impl/GovernanceBootstrapInitializer.java
@@ -141,7 +141,7 @@ public final class GovernanceBootstrapInitializer extends AbstractBootstrapIniti
         Optional<ServerConfiguration> scalingConfigurationOptional = getScalingConfiguration(yamlConfig);
         if (scalingConfigurationOptional.isPresent()) {
             ServerConfiguration serverConfiguration = scalingConfigurationOptional.get();
-            serverConfiguration.setDistributedScalingService(new GovernanceConfigurationYamlSwapper().swapToObject(yamlConfig.getServerConfiguration().getGovernance()));
+            serverConfiguration.setGovernanceConfig(new GovernanceConfigurationYamlSwapper().swapToObject(yamlConfig.getServerConfiguration().getGovernance()));
             ScalingContext.getInstance().init(serverConfiguration);
             ScalingWorkerLoader.initScalingWorker();
             ScalingServiceHolder.getInstance().init();
diff --git a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/resources/conf/server.yaml b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/resources/conf/server.yaml
index 678ba4d..7629c89 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/resources/conf/server.yaml
+++ b/shardingsphere-scaling/shardingsphere-scaling-bootstrap/src/main/resources/conf/server.yaml
@@ -15,12 +15,13 @@
 # limitations under the License.
 #
 
-port: 8888
-blockQueueSize: 10000
-workerThread: 30
+scaling:
+  port: 8888
+  blockQueueSize: 10000
+  workerThread: 30
 
-#distributedScalingService:
-#  name: ScalingJob
+#governance:
+#  name: governance_ds
 #  registryCenter:
 #    type: ZooKeeper
 #    serverLists: localhost:2181
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ServerConfiguration.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ServerConfiguration.java
index 9095496..78495fa 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ServerConfiguration.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/ServerConfiguration.java
@@ -34,5 +34,5 @@ public final class ServerConfiguration {
     
     private int workerThread = 30;
     
-    private GovernanceConfiguration distributedScalingService;
+    private GovernanceConfiguration governanceConfig;
 }
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ConfigurationYamlConverter.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ConfigurationYamlConverter.java
index b671e90..45eeaed 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ConfigurationYamlConverter.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/ConfigurationYamlConverter.java
@@ -21,6 +21,8 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.governance.core.yaml.config.YamlDataSourceConfigurationWrap;
+import org.apache.shardingsphere.governance.core.yaml.swapper.DataSourceConfigurationYamlSwapper;
 import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.YamlRootRuleConfigurations;
 import org.apache.shardingsphere.infra.yaml.config.YamlRuleConfiguration;
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/DataSourceConfigurationYamlSwapper.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/DataSourceConfigurationYamlSwapper.java
deleted file mode 100644
index 5631efe..0000000
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/DataSourceConfigurationYamlSwapper.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.datasource;
-
-import org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
-import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
-
-/**
- * Data source configuration YAML swapper.
- */
-public final class DataSourceConfigurationYamlSwapper implements YamlSwapper<YamlDataSourceConfiguration, DataSourceConfiguration> {
-    
-    @Override
-    public YamlDataSourceConfiguration swapToYamlConfiguration(final DataSourceConfiguration config) {
-        YamlDataSourceConfiguration result = new YamlDataSourceConfiguration();
-        result.setDataSourceClassName(config.getDataSourceClassName());
-        result.setProps(config.getProps());
-        return result;
-    }
-    
-    @Override
-    public DataSourceConfiguration swapToObject(final YamlDataSourceConfiguration yamlConfig) {
-        DataSourceConfiguration result = new DataSourceConfiguration(yamlConfig.getDataSourceClassName());
-        result.getProps().putAll(yamlConfig.getProps());
-        return result;
-    }
-}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/YamlDataSourceConfiguration.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/YamlDataSourceConfiguration.java
deleted file mode 100644
index 61a21eb..0000000
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/YamlDataSourceConfiguration.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.datasource;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Data source configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlDataSourceConfiguration implements YamlConfiguration {
-    
-    private String dataSourceClassName;
-    
-    private Map<String, Object> props = new HashMap<>();
-}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/YamlDataSourceConfigurationWrap.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/YamlDataSourceConfigurationWrap.java
deleted file mode 100644
index a4b3d44..0000000
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/datasource/YamlDataSourceConfigurationWrap.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.datasource;
-
-import java.util.Map;
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
-
-/**
- * Data source configuration warp for YAML.
- */
-@Getter
-@Setter
-public final class YamlDataSourceConfigurationWrap implements YamlConfiguration {
-    
-    private Map<String, YamlDataSourceConfiguration> dataSources;
-}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/GovernanceCenterConfigurationYamlSwapper.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/GovernanceCenterConfigurationYamlSwapper.java
deleted file mode 100644
index a4bfec6..0000000
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/GovernanceCenterConfigurationYamlSwapper.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.yaml;
-
-import org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
-
-/**
- * Governance center configuration YAML swapper.
- */
-public final class GovernanceCenterConfigurationYamlSwapper implements YamlSwapper<YamlGovernanceCenterConfiguration, GovernanceCenterConfiguration> {
-    
-    @Override
-    public YamlGovernanceCenterConfiguration swapToYamlConfiguration(final GovernanceCenterConfiguration config) {
-        YamlGovernanceCenterConfiguration result = new YamlGovernanceCenterConfiguration();
-        result.setType(config.getType());
-        result.setServerLists(config.getServerLists());
-        result.setProps(config.getProps());
-        return result;
-    }
-    
-    @Override
-    public GovernanceCenterConfiguration swapToObject(final YamlGovernanceCenterConfiguration yamlConfig) {
-        return new GovernanceCenterConfiguration(yamlConfig.getType(), yamlConfig.getServerLists(), yamlConfig.getProps());
-    }
-}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/GovernanceConfigurationYamlSwapper.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/GovernanceConfigurationYamlSwapper.java
deleted file mode 100644
index 3457505..0000000
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/GovernanceConfigurationYamlSwapper.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.yaml;
-
-import org.apache.shardingsphere.governance.repository.api.config.GovernanceCenterConfiguration;
-import org.apache.shardingsphere.governance.repository.api.config.GovernanceConfiguration;
-import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
-
-/**
- * Governance configuration YAML swapper.
- */
-public final class GovernanceConfigurationYamlSwapper implements YamlSwapper<YamlGovernanceConfiguration, GovernanceConfiguration> {
-    
-    private final GovernanceCenterConfigurationYamlSwapper governanceCenterConfigurationSwapper = new GovernanceCenterConfigurationYamlSwapper();
-    
-    @Override
-    public YamlGovernanceConfiguration swapToYamlConfiguration(final GovernanceConfiguration data) {
-        YamlGovernanceConfiguration result = new YamlGovernanceConfiguration();
-        result.setName(data.getName());
-        result.setRegistryCenter(governanceCenterConfigurationSwapper.swapToYamlConfiguration(data.getRegistryCenterConfiguration()));
-        if (data.getAdditionalConfigCenterConfiguration().isPresent()) {
-            result.setAdditionalConfigCenter(governanceCenterConfigurationSwapper.swapToYamlConfiguration(data.getAdditionalConfigCenterConfiguration().get()));
-        }
-        return result;
-    }
-    
-    @Override
-    public GovernanceConfiguration swapToObject(final YamlGovernanceConfiguration yamlConfig) {
-        GovernanceCenterConfiguration registryCenter = governanceCenterConfigurationSwapper.swapToObject(yamlConfig.getRegistryCenter());
-        if (null == yamlConfig.getAdditionalConfigCenter()) {
-            return new GovernanceConfiguration(yamlConfig.getName(), registryCenter, yamlConfig.isOverwrite());
-        }
-        GovernanceCenterConfiguration additionalConfigCenter = governanceCenterConfigurationSwapper.swapToObject(yamlConfig.getAdditionalConfigCenter());
-        return new GovernanceConfiguration(yamlConfig.getName(), registryCenter, additionalConfigCenter, yamlConfig.isOverwrite());
-    }
-}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapper.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapper.java
index 2e997b1..578316b 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapper.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/ServerConfigurationYamlSwapper.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.scaling.core.config.yaml;
 
+import org.apache.shardingsphere.governance.core.yaml.swapper.GovernanceConfigurationYamlSwapper;
 import org.apache.shardingsphere.infra.yaml.swapper.YamlSwapper;
 import org.apache.shardingsphere.scaling.core.config.ServerConfiguration;
 
@@ -30,11 +31,11 @@ public final class ServerConfigurationYamlSwapper implements YamlSwapper<YamlSer
     @Override
     public YamlServerConfiguration swapToYamlConfiguration(final ServerConfiguration data) {
         YamlServerConfiguration result = new YamlServerConfiguration();
-        result.setPort(data.getPort());
-        result.setBlockQueueSize(data.getBlockQueueSize());
-        result.setWorkerThread(data.getWorkerThread());
-        if (null != data.getDistributedScalingService()) {
-            result.setDistributedScalingService(governanceConfigurationYamlSwapper.swapToYamlConfiguration(data.getDistributedScalingService()));
+        result.getScaling().setPort(data.getPort());
+        result.getScaling().setBlockQueueSize(data.getBlockQueueSize());
+        result.getScaling().setWorkerThread(data.getWorkerThread());
+        if (null != data.getGovernanceConfig()) {
+            result.setGovernance(governanceConfigurationYamlSwapper.swapToYamlConfiguration(data.getGovernanceConfig()));
         }
         return result;
     }
@@ -42,11 +43,11 @@ public final class ServerConfigurationYamlSwapper implements YamlSwapper<YamlSer
     @Override
     public ServerConfiguration swapToObject(final YamlServerConfiguration yamlConfig) {
         ServerConfiguration result = new ServerConfiguration();
-        result.setPort(yamlConfig.getPort());
-        result.setBlockQueueSize(yamlConfig.getBlockQueueSize());
-        result.setWorkerThread(yamlConfig.getWorkerThread());
-        if (null != yamlConfig.getDistributedScalingService()) {
-            result.setDistributedScalingService(governanceConfigurationYamlSwapper.swapToObject(yamlConfig.getDistributedScalingService()));
+        result.setPort(yamlConfig.getScaling().getPort());
+        result.setBlockQueueSize(yamlConfig.getScaling().getBlockQueueSize());
+        result.setWorkerThread(yamlConfig.getScaling().getWorkerThread());
+        if (null != yamlConfig.getGovernance()) {
+            result.setGovernanceConfig(governanceConfigurationYamlSwapper.swapToObject(yamlConfig.getGovernance()));
         }
         return result;
     }
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlGovernanceCenterConfiguration.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlGovernanceCenterConfiguration.java
deleted file mode 100644
index 6a93956..0000000
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlGovernanceCenterConfiguration.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.yaml;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
-
-import java.util.Properties;
-
-/**
- * Governance center configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlGovernanceCenterConfiguration implements YamlConfiguration {
-    
-    private String type;
-    
-    private String serverLists;
-    
-    private Properties props = new Properties();
-}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlGovernanceConfiguration.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlGovernanceConfiguration.java
deleted file mode 100644
index 722daf3..0000000
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlGovernanceConfiguration.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.scaling.core.config.yaml;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
-
-/**
- * Governance configuration for YAML.
- */
-@Getter
-@Setter
-public final class YamlGovernanceConfiguration implements YamlConfiguration {
-    
-    private String name;
-    
-    private YamlGovernanceCenterConfiguration registryCenter;
-    
-    private YamlGovernanceCenterConfiguration additionalConfigCenter;
-    
-    private boolean overwrite;
-}
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlServerConfiguration.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlServerConfiguration.java
index 98517e3..6bf162c 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlServerConfiguration.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/config/yaml/YamlServerConfiguration.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.scaling.core.config.yaml;
 
 import lombok.Getter;
 import lombok.Setter;
+import org.apache.shardingsphere.governance.core.yaml.config.YamlGovernanceConfiguration;
 import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
 
 /**
@@ -28,11 +29,18 @@ import org.apache.shardingsphere.infra.yaml.config.YamlConfiguration;
 @Getter
 public final class YamlServerConfiguration implements YamlConfiguration {
     
-    private int port = 8080;
+    private YamlScalingConfiguration scaling = new YamlScalingConfiguration();
     
-    private int blockQueueSize = 10000;
+    private YamlGovernanceConfiguration governance;
     
-    private int workerThread = 30;
+    @Getter
+    @Setter
+    public static final class YamlScalingConfiguration {
     
-    private YamlGovernanceConfiguration distributedScalingService;
+        private int port = 8080;
+    
+        private int blockQueueSize = 10000;
+    
+        private int workerThread = 30;
+    }
 }
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/service/RegistryRepositoryHolder.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/service/RegistryRepositoryHolder.java
index 5257609..2c5b125 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/service/RegistryRepositoryHolder.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/service/RegistryRepositoryHolder.java
@@ -69,7 +69,7 @@ public final class RegistryRepositoryHolder {
         if (null != available) {
             return;
         }
-        GovernanceConfiguration governanceConfig = ScalingContext.getInstance().getServerConfig().getDistributedScalingService();
+        GovernanceConfiguration governanceConfig = ScalingContext.getInstance().getServerConfig().getGovernanceConfig();
         if (null != governanceConfig) {
             GovernanceCenterConfiguration registryCenterConfig = governanceConfig.getRegistryCenterConfiguration();
             Preconditions.checkNotNull(registryCenterConfig, "Registry center configuration cannot be null.");
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/spi/ScalingWorkerLoader.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/spi/ScalingWorkerLoader.java
index 005c09e..1467f4a 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/spi/ScalingWorkerLoader.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/spi/ScalingWorkerLoader.java
@@ -36,7 +36,7 @@ public final class ScalingWorkerLoader {
     public static void initScalingWorker() {
         log.info("Init scaling worker");
         ShardingSphereServiceLoader.register(ScalingWorker.class);
-        GovernanceConfiguration governanceConfig = ScalingContext.getInstance().getServerConfig().getDistributedScalingService();
+        GovernanceConfiguration governanceConfig = ScalingContext.getInstance().getServerConfig().getGovernanceConfig();
         if (null != governanceConfig) {
             Collection<ScalingWorker> scalingWorkers = ShardingSphereServiceLoader.newServiceInstances(ScalingWorker.class);
             for (ScalingWorker each : scalingWorkers) {
diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/service/impl/DistributedScalingJobServiceTest.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/service/impl/DistributedScalingJobServiceTest.java
index f4606d7..7a4a83f 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/service/impl/DistributedScalingJobServiceTest.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/test/java/org/apache/shardingsphere/scaling/core/service/impl/DistributedScalingJobServiceTest.java
@@ -145,7 +145,7 @@ public final class DistributedScalingJobServiceTest {
     private ServerConfiguration mockServerConfiguration() {
         resetRegistryRepositoryAvailable();
         ServerConfiguration result = new ServerConfiguration();
-        result.setDistributedScalingService(new GovernanceConfiguration("test", new GovernanceCenterConfiguration("REG_FIXTURE", "", null), false));
+        result.setGovernanceConfig(new GovernanceConfiguration("test", new GovernanceCenterConfiguration("REG_FIXTURE", "", null), false));
         return result;
     }