You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/04/22 02:22:47 UTC

[shardingsphere] branch master updated: Scaling IT test add local environment (#16985)

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

zhonghongsheng 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 e4cc6b27c93 Scaling IT test add local environment (#16985)
e4cc6b27c93 is described below

commit e4cc6b27c93e451a0e920a89c2c4f0a6ae149bba
Author: azexcy <10...@users.noreply.github.com>
AuthorDate: Fri Apr 22 10:22:41 2022 +0800

    Scaling IT test add local environment (#16985)
    
    * Scaling IT test add local environment
    
    * Code optimization
    
    * Add copyright
    
    * Add insert data method
    
    * Fix code style
---
 .../pom.xml                                        | 10 +++
 .../integration/data/pipline/cases/BaseITCase.java | 58 +++++++++----
 .../command/CommonSQLCommand.java}                 | 36 ++++----
 .../command/mysql/MySQLCommand.java}               | 32 ++++---
 .../pipline/cases/mysql/MySQLAutoRuleScaling.java  | 62 +++++++++++---
 .../BaseComposedContainer.java}                    | 62 ++++----------
 .../container/compose/DockerComposedContainer.java | 57 +++++++++++++
 .../LocalComposedContainer.java}                   | 33 +++++---
 .../{ => database}/DockerDatabaseContainer.java    | 11 ++-
 .../pipline/container/database/MySQLContainer.java |  5 +-
 .../container/database/PostgreSQLContainer.java    |  3 +-
 .../ShardingSphereProxyDockerContainer.java}       | 42 +---------
 .../proxy/ShardingSphereProxyLocalContainer.java   | 98 ++++++++++++++++++++++
 .../pipline/env/IntegrationTestEnvironment.java    |  7 +-
 .../enums/ITEnvTypeEnum.java}                      | 22 +----
 .../pipline/factory/DatabaseContainerFactory.java  |  2 +-
 .../common/{proxy/conf/logback.xml => command.xml} | 33 ++++----
 .../env/{common/proxy => }/conf/logback.xml        |  0
 .../env/{common/proxy => }/conf/server.yaml        |  0
 .../src/test/resources/env/it-env.properties       | 15 +---
 .../env/{it-env.properties => mysql/my.cnf}        | 23 ++---
 .../test/resources/env/mysql/rule_inti.properties  | 34 --------
 .../src/test/resources/env/mysql/sql.xml           | 59 +++++++++++++
 23 files changed, 445 insertions(+), 259 deletions(-)

diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml
index 078a0e2b5ca..5eabcfe76df 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml
@@ -31,6 +31,16 @@
     </properties>
     
     <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-proxy-frontend-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-proxy-bootstrap</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-data-pipeline-core</artifactId>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseITCase.java
index 3cabf98b7d4..1ec7ff03787 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseITCase.java
@@ -17,45 +17,71 @@
 
 package org.apache.shardingsphere.integration.data.pipline.cases;
 
+import com.google.common.base.Joiner;
 import lombok.AccessLevel;
 import lombok.Getter;
+import lombok.SneakyThrows;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.integration.data.pipline.container.ComposedContainer;
+import org.apache.shardingsphere.integration.data.pipline.container.compose.BaseComposedContainer;
+import org.apache.shardingsphere.integration.data.pipline.container.compose.DockerComposedContainer;
+import org.apache.shardingsphere.integration.data.pipline.container.compose.LocalComposedContainer;
+import org.apache.shardingsphere.integration.data.pipline.env.IntegrationTestEnvironment;
+import org.apache.shardingsphere.integration.data.pipline.env.enums.ITEnvTypeEnum;
 import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
 import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
 import org.apache.shardingsphere.mode.repository.cluster.zookeeper.CuratorZookeeperRepository;
-import org.apache.shardingsphere.test.integration.framework.container.atomic.governance.GovernanceContainer;
 import org.junit.Before;
 
-import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
 import java.util.List;
 import java.util.Properties;
 
 @Getter(AccessLevel.PROTECTED)
 public abstract class BaseITCase {
     
-    private DataSource targetDataSource;
-    
     @Getter(AccessLevel.NONE)
-    private final ComposedContainer composedContainer;
-    
-    private String databaseNetworkAlias;
+    private final BaseComposedContainer composedContainer;
     
     private ClusterPersistRepository clusterPersistRepository;
     
     public BaseITCase(final DatabaseType databaseType) {
-        composedContainer = new ComposedContainer(databaseType);
+        if (StringUtils.equalsIgnoreCase(IntegrationTestEnvironment.getInstance().getItEnvType(), ITEnvTypeEnum.DOCKER.name())) {
+            composedContainer = new DockerComposedContainer(databaseType);
+        } else {
+            composedContainer = new LocalComposedContainer(databaseType);
+        }
     }
     
     @Before
     public void setUp() {
         composedContainer.start();
-        targetDataSource = composedContainer.getTargetDataSource();
-        GovernanceContainer governanceContainer = composedContainer.getGovernanceContainer();
-        databaseNetworkAlias = composedContainer.getDatabaseNetworkAlias();
         clusterPersistRepository = new CuratorZookeeperRepository();
-        clusterPersistRepository.init(new ClusterPersistRepositoryConfiguration("ZooKeeper", "it_db", governanceContainer.getServerLists(), new Properties()));
-        System.out.println(clusterPersistRepository.get("/"));
+        clusterPersistRepository.init(new ClusterPersistRepositoryConfiguration("ZooKeeper", "it_db", composedContainer.getGovernanceContainer().getServerLists(), new Properties()));
+    }
+    
+    /**
+     * Get proxy database connection.
+     *
+     * @return proxy database connection
+     */
+    @SneakyThrows(SQLException.class)
+    public Connection getProxyConnection() {
+        return composedContainer.getProxyConnection();
+    }
+    
+    /**
+     * Get database url, such as  ip:port.
+     *
+     * @return database url
+     */
+    public String getDatabaseUrl() {
+        if (StringUtils.equalsIgnoreCase(IntegrationTestEnvironment.getInstance().getItEnvType(), ITEnvTypeEnum.DOCKER.name())) {
+            return Joiner.on(":").join("db.host", composedContainer.getDatabaseContainer().getPort());
+        } else {
+            return Joiner.on(":").join(composedContainer.getDatabaseContainer().getHost(), composedContainer.getDatabaseContainer().getFirstMappedPort());
+        }
     }
     
     /**
@@ -64,7 +90,7 @@ public abstract class BaseITCase {
      * @return actual source database name list
      */
     public List<String> listSourceDatabaseName() {
-        return composedContainer.listSourceDatabaseName();
+        return composedContainer.getDatabaseContainer().getSourceDatabaseNames();
     }
     
     /**
@@ -73,6 +99,6 @@ public abstract class BaseITCase {
      * @return actual target database name list
      */
     public List<String> listTargetDatabaseName() {
-        return composedContainer.listTargetDatabaseName();
+        return composedContainer.getDatabaseContainer().getTargetDatabaseNames();
     }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CommonSQLCommand.java
similarity index 53%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CommonSQLCommand.java
index b226d05b15f..4c36d4e13fd 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CommonSQLCommand.java
@@ -15,25 +15,29 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipline.container.database;
+package org.apache.shardingsphere.integration.data.pipline.cases.command;
 
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.integration.data.pipline.container.DockerDatabaseContainer;
+import lombok.Data;
 
-// TODO not complete yet
-public class PostgreSQLContainer extends DockerDatabaseContainer {
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@Data
+@XmlRootElement(name = "command")
+@XmlAccessorType(XmlAccessType.FIELD)
+public final class CommonSQLCommand {
+    
+    @XmlElement(name = "add-resource")
+    private String addResource;
     
-    public PostgreSQLContainer(final String dockerImageName) {
-        super(DatabaseTypeRegistry.getActualDatabaseType("PostgreSQL"), dockerImageName);
-    }
+    @XmlElement(name = "create-database")
+    private String createDatabase;
     
-    @Override
-    public void start() {
-        
-    }
+    @XmlElement(name = "use-database")
+    private String useDatabase;
     
-    @Override
-    protected int getPort() {
-        return 5432;
-    }
+    @XmlElement(name = "create-sharding-table-rule")
+    private String createShardingTableRule;
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/mysql/MySQLCommand.java
similarity index 56%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/mysql/MySQLCommand.java
index b226d05b15f..c15d57d2b31 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/mysql/MySQLCommand.java
@@ -15,25 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipline.container.database;
+package org.apache.shardingsphere.integration.data.pipline.cases.command.mysql;
 
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.integration.data.pipline.container.DockerDatabaseContainer;
+import lombok.Data;
 
-// TODO not complete yet
-public class PostgreSQLContainer extends DockerDatabaseContainer {
-    
-    public PostgreSQLContainer(final String dockerImageName) {
-        super(DatabaseTypeRegistry.getActualDatabaseType("PostgreSQL"), dockerImageName);
-    }
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@Data
+@XmlRootElement(name = "command")
+@XmlAccessorType(XmlAccessType.FIELD)
+public final class MySQLCommand {
     
-    @Override
-    public void start() {
-        
-    }
+    @XmlElement(name = "create-table-order")
+    private String createTableOrder;
     
-    @Override
-    protected int getPort() {
-        return 5432;
-    }
+    @XmlElement(name = "insert-order")
+    private String insertOrder;
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLAutoRuleScaling.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLAutoRuleScaling.java
index a5cf19aeba0..c6a1e1fd572 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLAutoRuleScaling.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLAutoRuleScaling.java
@@ -20,17 +20,27 @@ package org.apache.shardingsphere.integration.data.pipline.cases.mysql;
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
 import org.apache.shardingsphere.integration.data.pipline.cases.BaseITCase;
+import org.apache.shardingsphere.integration.data.pipline.cases.command.CommonSQLCommand;
+import org.apache.shardingsphere.integration.data.pipline.cases.command.mysql.MySQLCommand;
+import org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
 import org.junit.Before;
 import org.junit.Test;
 
+import javax.xml.bind.JAXB;
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
 import java.sql.Connection;
-import java.util.Properties;
+import java.sql.PreparedStatement;
+import java.sql.Timestamp;
+import java.util.Objects;
 
 /**
  * MySQL auto rule scaling test case.
  */
 public final class MySQLAutoRuleScaling extends BaseITCase {
     
+    private static final SnowflakeKeyGenerateAlgorithm SNOWFLAKE_GENERATE = new SnowflakeKeyGenerateAlgorithm();
+    
     public MySQLAutoRuleScaling() {
         super(new MySQLDatabaseType());
     }
@@ -39,26 +49,56 @@ public final class MySQLAutoRuleScaling extends BaseITCase {
     @Before
     public void setUp() {
         super.setUp();
-        Properties initProps = new Properties();
-        initProps.load(getClass().getClassLoader().getResourceAsStream("env/mysql/rule_inti.properties"));
-        try (Connection connection = getTargetDataSource().getConnection()) {
-            connection.createStatement().execute("CREATE DATABASE sharding_db;");
-            connection.createStatement().execute("USE sharding_db;");
+        CommonSQLCommand commonSQLCommand = JAXB.unmarshal(Objects.requireNonNull(getClass().getClassLoader().getResource("env/common/command.xml")), CommonSQLCommand.class);
+        MySQLCommand mysqlCommand = JAXB.unmarshal(Objects.requireNonNull(getClass().getClassLoader().getResource("env/mysql/sql.xml")), MySQLCommand.class);
+        try (Connection connection = getProxyConnection()) {
+            connection.createStatement().execute(commonSQLCommand.getCreateDatabase());
+            connection.createStatement().execute(commonSQLCommand.getUseDatabase());
             int dbIndex = 0;
-            for (String value : listSourceDatabaseName()) {
-                connection.createStatement().execute(String.format(initProps.getProperty("add.resource.sql"), dbIndex, getDatabaseNetworkAlias(), value));
+            for (String dbName : listSourceDatabaseName()) {
+                connection.createStatement().execute(String.format(commonSQLCommand.getAddResource(), dbIndex, getDatabaseUrl(), dbName));
                 dbIndex++;
             }
             for (String value : listTargetDatabaseName()) {
-                connection.createStatement().execute(String.format(initProps.getProperty("add.resource.sql"), dbIndex, getDatabaseNetworkAlias(), value));
+                connection.createStatement().execute(String.format(commonSQLCommand.getAddResource(), dbIndex, getDatabaseUrl(), value));
                 dbIndex++;
             }
-            connection.createStatement().execute(initProps.getProperty("create.table.rule"));
-            connection.createStatement().execute(initProps.getProperty("create.table.sql"));
+            connection.createStatement().execute(commonSQLCommand.getCreateShardingTableRule());
+            connection.createStatement().execute(mysqlCommand.getCreateTableOrder());
+            // init date, need more than 3000 rows, in order to test certain conditions
+            initTableDataOfOrder(connection, mysqlCommand.getInsertOrder(), 1000);
+        }
+    }
+    
+    private void initTableDataOfOrder(final Connection connection, final String insertSQL, final int batchSize) throws Exception {
+        connection.setAutoCommit(false);
+        PreparedStatement statement = connection.prepareStatement(insertSQL);
+        for (int i = 1; i <= 5000; i++) {
+            statement.setLong(1, (Long) SNOWFLAKE_GENERATE.generateKey());
+            statement.setString(2, "varchar" + i);
+            statement.setByte(3, (byte) 1);
+            statement.setInt(4, 100);
+            Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+            statement.setTimestamp(5, timestamp);
+            statement.setTimestamp(6, timestamp);
+            statement.setBytes(7, "hello".getBytes(StandardCharsets.UTF_8));
+            statement.setBinaryStream(8, null);
+            statement.setBigDecimal(9, new BigDecimal("100.00"));
+            statement.setString(10, "test");
+            statement.setDouble(11, Math.random());
+            statement.setString(12, "{}");
+            statement.addBatch();
+            if (i % batchSize == 0) {
+                statement.executeBatch();
+                statement.clearParameters();
+            }
         }
+        connection.commit();
+        connection.setAutoCommit(true);
     }
     
     @Test
     public void test() {
+        
     }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/ComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/BaseComposedContainer.java
similarity index 59%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/ComposedContainer.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/BaseComposedContainer.java
index f591954125e..1fdb0e4473f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/ComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/BaseComposedContainer.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipline.container;
+package org.apache.shardingsphere.integration.data.pipline.container.compose;
 
 import lombok.Getter;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.integration.data.pipline.container.database.DockerDatabaseContainer;
 import org.apache.shardingsphere.integration.data.pipline.factory.DatabaseContainerFactory;
 import org.apache.shardingsphere.test.integration.framework.container.atomic.ITContainers;
 import org.apache.shardingsphere.test.integration.framework.container.atomic.governance.GovernanceContainer;
@@ -26,66 +27,39 @@ import org.apache.shardingsphere.test.integration.framework.container.atomic.gov
 import org.apache.shardingsphere.test.integration.util.NetworkAliasUtil;
 import org.testcontainers.lifecycle.Startable;
 
-import javax.sql.DataSource;
-import java.util.List;
+import java.sql.Connection;
+import java.sql.SQLException;
 
-public final class ComposedContainer implements Startable {
+@Getter
+public abstract class BaseComposedContainer implements Startable {
     
     private final ITContainers containers;
     
-    @Getter
     private final GovernanceContainer governanceContainer;
     
     private final DockerDatabaseContainer databaseContainer;
     
-    private final ShardingSphereProxyContainer proxyContainer;
-    
-    @Getter
-    private final String databaseNetworkAlias = NetworkAliasUtil.getNetworkAlias("db");
-    
-    public ComposedContainer(final DatabaseType databaseType) {
+    public BaseComposedContainer(final DatabaseType databaseType) {
         this.containers = new ITContainers("");
         this.governanceContainer = containers.registerContainer(GovernanceContainerFactory.newInstance("ZooKeeper"), NetworkAliasUtil.getNetworkAlias("zk"));
-        this.databaseContainer = containers.registerContainer(DatabaseContainerFactory.newInstance(databaseType), databaseNetworkAlias);
-        ShardingSphereProxyContainer proxyContainer = new ShardingSphereProxyContainer(databaseType, "");
-        proxyContainer.dependsOn(governanceContainer, databaseContainer);
-        this.proxyContainer = containers.registerContainer(proxyContainer, NetworkAliasUtil.getNetworkAlias("sharding-proxy"));
-    }
-    
-    @Override
-    public void start() {
-        containers.start();
-    }
-    
-    @Override
-    public void stop() {
-        containers.stop();
+        this.databaseContainer = containers.registerContainer(DatabaseContainerFactory.newInstance(databaseType), NetworkAliasUtil.getNetworkAlias("db"));
     }
     
     /**
-     * Get target data source.
+     * Get proxy connection.
      *
-     * @return target data source.
+     * @return sql connection.
+     * @throws SQLException sql exception
      */
-    public DataSource getTargetDataSource() {
-        return proxyContainer.getTargetDataSource();
-    }
+    public abstract Connection getProxyConnection() throws SQLException;
     
-    /**
-     * Get actual data source map.
-     *
-     * @return actual data source map
-     */
-    public List<String> listSourceDatabaseName() {
-        return databaseContainer.getSourceDatabaseNames();
+    @Override
+    public void start() {
+        getContainers().start();
     }
     
-    /**
-     * Get expected data source map.
-     *
-     * @return expected data source map
-     */
-    public List<String> listTargetDatabaseName() {
-        return databaseContainer.getTargetDatabaseNames();
+    @Override
+    public void stop() {
+        getContainers().stop();
     }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/DockerComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/DockerComposedContainer.java
new file mode 100644
index 00000000000..8ca9677f39f
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/DockerComposedContainer.java
@@ -0,0 +1,57 @@
+/*
+ * 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.integration.data.pipline.container.compose;
+
+import lombok.Getter;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.integration.data.pipline.container.proxy.ShardingSphereProxyDockerContainer;
+import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
+import org.apache.shardingsphere.test.integration.util.NetworkAliasUtil;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * Composed container, include governance container and database container.
+ */
+public final class DockerComposedContainer extends BaseComposedContainer {
+    
+    @Getter
+    private final ShardingSphereProxyDockerContainer proxyContainer;
+    
+    public DockerComposedContainer(final DatabaseType databaseType) {
+        super(databaseType);
+        ShardingSphereProxyDockerContainer proxyContainer = new ShardingSphereProxyDockerContainer(databaseType);
+        proxyContainer.addExposedPort(3307);
+        proxyContainer.dependsOn(getGovernanceContainer(), getDatabaseContainer());
+        this.proxyContainer = getContainers().registerContainer(proxyContainer, NetworkAliasUtil.getNetworkAlias("sharding-proxy"));
+    }
+    
+    @Override
+    public void stop() {
+        super.stop();
+        proxyContainer.stop();
+    }
+    
+    @Override
+    public Connection getProxyConnection() throws SQLException {
+        return DriverManager.getConnection(DataSourceEnvironment.getURL(getDatabaseContainer().getDatabaseType(),
+                getProxyContainer().getHost(), getProxyContainer().getFirstMappedPort(), ""), "root", "root");
+    }
+}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/LocalComposedContainer.java
similarity index 51%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/LocalComposedContainer.java
index b226d05b15f..91e681dc615 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/LocalComposedContainer.java
@@ -15,25 +15,38 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipline.container.database;
+package org.apache.shardingsphere.integration.data.pipline.container.compose;
 
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.integration.data.pipline.container.DockerDatabaseContainer;
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.integration.data.pipline.container.proxy.ShardingSphereProxyLocalContainer;
+import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
 
-// TODO not complete yet
-public class PostgreSQLContainer extends DockerDatabaseContainer {
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+/**
+ * Local composed container.
+ */
+public final class LocalComposedContainer extends BaseComposedContainer {
+    
+    private ShardingSphereProxyLocalContainer shardingSphereProxyContainer;
     
-    public PostgreSQLContainer(final String dockerImageName) {
-        super(DatabaseTypeRegistry.getActualDatabaseType("PostgreSQL"), dockerImageName);
+    public LocalComposedContainer(final DatabaseType databaseType) {
+        super(databaseType);
     }
     
+    @SneakyThrows
     @Override
     public void start() {
-        
+        super.start();
+        shardingSphereProxyContainer = new ShardingSphereProxyLocalContainer(getGovernanceContainer().getServerLists(), getDatabaseContainer().getDatabaseType());
+        shardingSphereProxyContainer.start();
     }
     
     @Override
-    protected int getPort() {
-        return 5432;
+    public Connection getProxyConnection() throws SQLException {
+        return DriverManager.getConnection(DataSourceEnvironment.getURL(getDatabaseContainer().getDatabaseType(), "localhost", 3307, ""), "root", "root");
     }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/DockerDatabaseContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/DockerDatabaseContainer.java
similarity index 94%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/DockerDatabaseContainer.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/DockerDatabaseContainer.java
index ae583a1a622..a8d3df3bcdd 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/DockerDatabaseContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/DockerDatabaseContainer.java
@@ -15,10 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipline.container;
+package org.apache.shardingsphere.integration.data.pipline.container.database;
 
 import lombok.Getter;
-import lombok.SneakyThrows;
 import org.apache.curator.shaded.com.google.common.collect.Lists;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.test.integration.framework.container.atomic.DockerITContainer;
@@ -52,11 +51,15 @@ public abstract class DockerDatabaseContainer extends DockerITContainer {
     }
     
     @Override
-    @SneakyThrows
     protected void postStart() {
         sourceDatabaseNames.addAll(Lists.newArrayList("ds_0", "ds_1"));
         targetDatabaseNames.addAll(Lists.newArrayList("ds_2", "ds_3", "ds_4"));
     }
     
-    protected abstract int getPort();
+    /**
+     * Get database port.
+     *
+     * @return database port
+     */
+    public abstract int getPort();
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/MySQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/MySQLContainer.java
index 9dfc96f4dcb..27633810b29 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/MySQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/MySQLContainer.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.integration.data.pipline.container.database;
 
 import com.google.common.collect.Lists;
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.integration.data.pipline.container.DockerDatabaseContainer;
+import org.testcontainers.containers.BindMode;
 
 public class MySQLContainer extends DockerDatabaseContainer {
     
@@ -30,13 +30,14 @@ public class MySQLContainer extends DockerDatabaseContainer {
     @Override
     protected void configure() {
         super.configure();
+        withClasspathResourceMapping("/env/mysql/my.cnf", "/etc/mysql/my.cnf", BindMode.READ_ONLY);
         withExposedPorts(3306);
         setEnv(Lists.newArrayList("LANG=C.UTF-8", "MYSQL_ROOT_PASSWORD=root", "MYSQL_ROOT_HOST=%", "MYSQL_DATABASE=test"));
         withCommand("--sql_mode=", "--default-authentication-plugin=mysql_native_password", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci");
     }
     
     @Override
-    protected int getPort() {
+    public int getPort() {
         return 3306;
     }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
index b226d05b15f..d2c7d264e22 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.integration.data.pipline.container.database;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.integration.data.pipline.container.DockerDatabaseContainer;
 
 // TODO not complete yet
 public class PostgreSQLContainer extends DockerDatabaseContainer {
@@ -33,7 +32,7 @@ public class PostgreSQLContainer extends DockerDatabaseContainer {
     }
     
     @Override
-    protected int getPort() {
+    public int getPort() {
         return 5432;
     }
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/ShardingSphereProxyContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/proxy/ShardingSphereProxyDockerContainer.java
similarity index 65%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/ShardingSphereProxyContainer.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/proxy/ShardingSphereProxyDockerContainer.java
index 2e381a4a4f3..9df79bef2eb 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/ShardingSphereProxyContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/proxy/ShardingSphereProxyDockerContainer.java
@@ -15,9 +15,8 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipline.container;
+package org.apache.shardingsphere.integration.data.pipline.container.proxy;
 
-import com.zaxxer.hikari.HikariDataSource;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
@@ -27,30 +26,22 @@ import org.rnorth.ducttape.unreliables.Unreliables;
 import org.testcontainers.containers.BindMode;
 import org.testcontainers.containers.wait.strategy.AbstractWaitStrategy;
 
-import javax.sql.DataSource;
 import java.sql.Connection;
 import java.sql.DriverManager;
-import java.util.Objects;
 import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * ShardingSphere proxy container.
  */
 @Slf4j
-public final class ShardingSphereProxyContainer extends DockerITContainer {
+public final class ShardingSphereProxyDockerContainer extends DockerITContainer {
     
     private final DatabaseType databaseType;
     
-    private final String schemaName;
-    
-    private final AtomicReference<DataSource> targetDataSourceProvider = new AtomicReference<>();
-    
-    public ShardingSphereProxyContainer(final DatabaseType databaseType, final String schemaName) {
+    public ShardingSphereProxyDockerContainer(final DatabaseType databaseType) {
         super("Scaling-Proxy", "apache/shardingsphere-proxy-test");
         this.databaseType = databaseType;
-        this.schemaName = schemaName;
     }
     
     @Override
@@ -61,32 +52,7 @@ public final class ShardingSphereProxyContainer extends DockerITContainer {
     }
     
     private void mapConfigurationFiles() {
-        String containerPath = "/opt/shardingsphere-proxy/conf";
-        withClasspathResourceMapping("/env/common/proxy/conf/", containerPath, BindMode.READ_ONLY);
-    }
-    
-    /**
-     * Get target data source.
-     *
-     * @return target data source.
-     */
-    public DataSource getTargetDataSource() {
-        DataSource dataSource = targetDataSourceProvider.get();
-        if (Objects.isNull(dataSource)) {
-            targetDataSourceProvider.set(createProxyDataSource());
-        }
-        return targetDataSourceProvider.get();
-    }
-    
-    private DataSource createProxyDataSource() {
-        HikariDataSource result = new HikariDataSource();
-        result.setDriverClassName(DataSourceEnvironment.getDriverClassName(databaseType));
-        result.setJdbcUrl(DataSourceEnvironment.getURL(databaseType, getHost(), getMappedPort(3307), schemaName));
-        result.setUsername("root");
-        result.setPassword("root");
-        result.setMaximumPoolSize(2);
-        result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
-        return result;
+        withClasspathResourceMapping("/env/conf/", "/opt/shardingsphere-proxy/conf", BindMode.READ_ONLY);
     }
     
     @Slf4j
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/proxy/ShardingSphereProxyLocalContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/proxy/ShardingSphereProxyLocalContainer.java
new file mode 100644
index 00000000000..432dec82f0c
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/proxy/ShardingSphereProxyLocalContainer.java
@@ -0,0 +1,98 @@
+/*
+ * 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.integration.data.pipline.container.proxy;
+
+import lombok.Getter;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader;
+import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
+import org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy;
+import org.apache.shardingsphere.proxy.initializer.BootstrapInitializer;
+import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.concurrent.TimeUnit;
+
+@Slf4j
+@Getter
+public class ShardingSphereProxyLocalContainer {
+    
+    private final String serverList;
+    
+    private final DatabaseType databaseType;
+    
+    private volatile boolean started;
+    
+    @SneakyThrows
+    public ShardingSphereProxyLocalContainer(final String serverList, final DatabaseType databaseType) {
+        this.serverList = serverList;
+        this.databaseType = databaseType;
+    }
+    
+    /**
+     * Wait proxy started.
+     *
+     * @param databaseType database type
+     */
+    @SneakyThrows
+    public void waitProxyStarted(final DatabaseType databaseType) {
+        for (int retry = 0; retry < 60; retry++) {
+            try (Connection connection = DriverManager.getConnection(DataSourceEnvironment.getURL(databaseType, "localhost", 3307, ""), "root", "root")) {
+                log.info("Container ready");
+                started = true;
+                return;
+                // CHECKSTYLE:OFF
+            } catch (final Exception ignored) {
+                // CHECKSTYLE:ON
+            }
+            TimeUnit.SECONDS.sleep(1);
+        }
+        throw new RuntimeException("Proxy not started");
+    }
+    
+    /**
+     * Start proxy.
+     */
+    @SneakyThrows
+    public void start() {
+        if (started) {
+            return;
+        }
+        synchronized (this) {
+            if (started) {
+                return;
+            }
+            new Thread(() -> {
+                try {
+                    YamlProxyConfiguration yamlConfig = ProxyConfigurationLoader.load("/env/conf");
+                    yamlConfig.getServerConfiguration().getMode().getRepository().getProps().setProperty("server-lists", serverList);
+                    new BootstrapInitializer().init(yamlConfig, 3307);
+                    new ShardingSphereProxy().start(3307);
+                } catch (final IOException | SQLException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }).start();
+            waitProxyStarted(databaseType);
+        }
+    }
+}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/env/IntegrationTestEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/env/IntegrationTestEnvironment.java
index d0138d2deb1..90dab938dd3 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/env/IntegrationTestEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/env/IntegrationTestEnvironment.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.integration.data.pipline.env;
 
 import lombok.Getter;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.integration.data.pipline.util.ExecuteUtil;
 import org.apache.shardingsphere.integration.data.pipline.util.ScalingUtil;
@@ -36,17 +37,19 @@ public final class IntegrationTestEnvironment {
     
     private final Properties props;
     
+    private final String itEnvType;
+    
     private IntegrationTestEnvironment() {
         props = loadProperties("env/it-env.properties");
+        itEnvType = props.getProperty("it.env.type");
         isEnvironmentPrepared = false;
     }
     
+    @SneakyThrows
     private Properties loadProperties(final String propsFileName) {
         Properties result = new Properties();
         try (InputStream inputStream = IntegrationTestEnvironment.class.getClassLoader().getResourceAsStream(propsFileName)) {
             result.load(inputStream);
-        } catch (final IOException ex) {
-            throw new RuntimeException(ex);
         }
         return result;
     }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/env/enums/ITEnvTypeEnum.java
similarity index 56%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/env/enums/ITEnvTypeEnum.java
index b226d05b15f..d19990e83c0 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/database/PostgreSQLContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/env/enums/ITEnvTypeEnum.java
@@ -15,25 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.integration.data.pipline.container.database;
+package org.apache.shardingsphere.integration.data.pipline.env.enums;
 
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeRegistry;
-import org.apache.shardingsphere.integration.data.pipline.container.DockerDatabaseContainer;
-
-// TODO not complete yet
-public class PostgreSQLContainer extends DockerDatabaseContainer {
-    
-    public PostgreSQLContainer(final String dockerImageName) {
-        super(DatabaseTypeRegistry.getActualDatabaseType("PostgreSQL"), dockerImageName);
-    }
-    
-    @Override
-    public void start() {
-        
-    }
+public enum ITEnvTypeEnum {
     
-    @Override
-    protected int getPort() {
-        return 5432;
-    }
+    DOCKER, LOCAL;
 }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/factory/DatabaseContainerFactory.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/factory/DatabaseContainerFactory.java
index ab0a9c938e9..e5f3653de95 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/factory/DatabaseContainerFactory.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/factory/DatabaseContainerFactory.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.integration.data.pipline.factory;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.integration.data.pipline.container.DockerDatabaseContainer;
+import org.apache.shardingsphere.integration.data.pipline.container.database.DockerDatabaseContainer;
 import org.apache.shardingsphere.integration.data.pipline.container.database.MySQLContainer;
 import org.apache.shardingsphere.integration.data.pipline.container.database.PostgreSQLContainer;
 
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/proxy/conf/logback.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
similarity index 50%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/proxy/conf/logback.xml
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
index 1494746120c..01571e2b82f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/proxy/conf/logback.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0"?>
 <!--
   ~ Licensed to the Apache Software Foundation (ASF) under one or more
   ~ contributor license agreements.  See the NOTICE file distributed with
@@ -16,18 +15,22 @@
   ~ limitations under the License.
   -->
 
-<configuration>
-    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
-        </encoder>
-    </appender>
-    <logger name="org.apache.shardingsphere" level="info" additivity="false">
-        <appender-ref ref="console" />
-    </logger>
+<command>
+    <create-database>
+        CREATE DATABASE sharding_db;
+    </create-database>
     
-    <root>
-        <level value="info" />
-        <appender-ref ref="console" />
-    </root>
-</configuration> 
+    <use-database>
+        USE sharding_db;
+    </use-database>
+    
+    <add-resource>
+        ADD RESOURCE ds_%s (URL="jdbc:mysql://%s/%s?serverTimezone=UTC&amp;useSSL=false&amp;rewriteBatchedStatements=true",USER=root,PASSWORD=root);
+    </add-resource>
+    
+    <create-sharding-table-rule>
+        CREATE SHARDING TABLE RULE
+        t_order(RESOURCES(ds_0,ds_1),SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=4)),KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake))),
+        t_order_item(RESOURCES(ds_0,ds_1),SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=4)),KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake)));
+    </create-sharding-table-rule>
+</command>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/proxy/conf/logback.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/conf/logback.xml
similarity index 100%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/proxy/conf/logback.xml
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/conf/logback.xml
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/conf/server.yaml
similarity index 100%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/proxy/conf/server.yaml
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/conf/server.yaml
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
index aa594cdf669..ebe37095f63 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
@@ -15,20 +15,11 @@
 # limitations under the License.
 #
 
-#it.modes=Memory,Cluster
-it.run.modes=Memory
-
-it.scenarios=scaling
-
-# it.cluster.env.type=DOCKER,NATIVE
-it.cluster.env.type=DOCKER
-
-# it.cluster.adapters=jdbc,proxy
-it.cluster.adapters=proxy
+# it.env.type=DOCKER,LOCAL
+it.env.type=LOCAL
 
 # it.cluster.databases=MySQL,PostgreSQL
-it.cluster.databases=MySQL
+it.env.databases=MySQL
 
 scaling.waitMs=5000
-
 scaling.retry=30
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/my.cnf
similarity index 72%
copy from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
copy to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/my.cnf
index aa594cdf669..4d1f45b5523 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/it-env.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/my.cnf
@@ -15,20 +15,11 @@
 # limitations under the License.
 #
 
-#it.modes=Memory,Cluster
-it.run.modes=Memory
+[mysql]
 
-it.scenarios=scaling
-
-# it.cluster.env.type=DOCKER,NATIVE
-it.cluster.env.type=DOCKER
-
-# it.cluster.adapters=jdbc,proxy
-it.cluster.adapters=proxy
-
-# it.cluster.databases=MySQL,PostgreSQL
-it.cluster.databases=MySQL
-
-scaling.waitMs=5000
-
-scaling.retry=30
+[mysqld]
+server-id=1
+log-bin=mysql-bin
+binlog-format=row
+binlog-row-image=full
+max_connections=600
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/rule_inti.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/rule_inti.properties
deleted file mode 100644
index 07eabd79499..00000000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/rule_inti.properties
+++ /dev/null
@@ -1,34 +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.
-#
-create.table.rule=CREATE SHARDING TABLE RULE t_order(RESOURCES(ds_0,ds_1),SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=4)),KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake))), t_order_item(RESOURCES(ds_0,ds_1),SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=4)),KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME=snowflake)));
-create.table.sql=CREATE TABLE `t_order` (\
-`id` BIGINT NOT NULL COMMENT 'pk id',\
-`t_varchar` VARCHAR ( 255 ) NOT NULL,\
-`t_tinyint` TINYINT ( 1 ) NULL,\
-`t_int` INT NULL,\
-`t_timestamp` TIMESTAMP NULL,\
-`t_datetime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,\
-`t_binary` BINARY NULL,\
-`t_blob` BLOB NULL,\
-`t_decimal` DECIMAL ( 10, 2 ) NULL,\
-`t_char` CHAR ( 128 ) NULL,\
-`t_double` DOUBLE NULL,\
-`t_json` json NULL COMMENT 'json test',\
-PRIMARY KEY ( `id` ),\
-UNIQUE INDEX ( `t_varchar` ),\
-INDEX ( `t_int` ) );
-add.resource.sql=ADD RESOURCE ds_%s (URL="jdbc:mysql://%s:3306/%s?serverTimezone=UTC&useSSL=false",USER=root,PASSWORD=root)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/sql.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/sql.xml
new file mode 100644
index 00000000000..07a2b012acd
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/mysql/sql.xml
@@ -0,0 +1,59 @@
+<!--
+  ~ 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.
+  -->
+<command>
+    <create-table-order>
+        CREATE TABLE `t_order` (
+        `id` BIGINT NOT NULL COMMENT 'pk id',
+        `t_varchar` VARCHAR ( 255 ) NOT NULL,
+        `t_tinyint` TINYINT ( 1 ) NULL,
+        `order_id` INT NULL,
+        `t_timestamp` TIMESTAMP NULL,
+        `t_datetime` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
+        `t_binary` BINARY(255) NULL,
+        `t_blob` BLOB NULL,
+        `t_decimal` DECIMAL ( 10, 2 ) NULL,
+        `t_char` CHAR ( 128 ) NULL,
+        `t_double` DOUBLE NULL,
+        `t_json` json NULL COMMENT 'json test',
+        PRIMARY KEY ( `id` ),
+        UNIQUE INDEX ( `t_varchar` ),
+        INDEX ( `order_id` )
+        );
+    </create-table-order>
+    
+    <insert-order>
+        INSERT INTO `t_order` (
+        `id`,
+        `t_varchar`,
+        `t_tinyint`,
+        `order_id`,
+        `t_timestamp`,
+        `t_datetime`,
+        `t_binary`,
+        `t_blob`,
+        `t_decimal`,
+        `t_char`,
+        `t_double`,
+        `t_json`
+        )
+        VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );
+    </insert-order>
+    
+    <create-table-orderitem>
+    
+    </create-table-orderitem>
+</command>