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 2020/09/29 09:47:25 UTC

[shardingsphere-ui] branch master updated: update scaling start api. (#26)

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-ui.git


The following commit(s) were added to refs/heads/master by this push:
     new 8277dd9  update scaling start api. (#26)
8277dd9 is described below

commit 8277dd9de80a689aab85d917e1b0249e754155e8
Author: 邱鹿 Lucas <lu...@163.com>
AuthorDate: Tue Sep 29 17:46:34 2020 +0800

    update scaling start api. (#26)
    
    Co-authored-by: qiulu3 <Lucas209910>
---
 .../shardingsphere-ui-backend-API.md               | 139 +++++++++++++--------
 .../src/views/data-scaling/module/index.vue        |  20 ++-
 2 files changed, 98 insertions(+), 61 deletions(-)

diff --git a/shardingsphere-ui-backend/shardingsphere-ui-backend-API.md b/shardingsphere-ui-backend/shardingsphere-ui-backend-API.md
index 20311a2..d2c88b3 100644
--- a/shardingsphere-ui-backend/shardingsphere-ui-backend-API.md
+++ b/shardingsphere-ui-backend/shardingsphere-ui-backend-API.md
@@ -729,15 +729,36 @@ POST /api/shardingscaling/job/start
 
 #### Body
 
-| Parameter                                         | Describe                                        |
-| ------------------------------------------------- | ----------------------------------------------- |
-| ruleConfiguration.sourceDataSource                | source sharding proxy data source configuration |
-| ruleConfiguration.sourceRule                      | source sharding proxy table rule configuration  |
-| ruleConfiguration.targetDataSources.name          | target sharding proxy name                      |
-| ruleConfiguration.targetDataSources.url           | target sharding proxy jdbc url                  |
-| ruleConfiguration.targetDataSources.username      | target sharding proxy username                  |
-| ruleConfiguration.targetDataSources.password      | target sharding proxy password                  |
-| jobConfiguration.concurrency                      | sync task proposed concurrency                  |
+| Parameter                                         | Describe                                                     |
+| ------------------------------------------------- | ------------------------------------------------------------ |
+| ruleConfiguration.source                          | source data source configuration                             |
+| ruleConfiguration.target                          | target data source configuration                             |
+| jobConfiguration.concurrency                      | sync task proposed concurrency                               |
+
+Data source configuration:
+
+| Parameter                                         | Describe                                                     |
+| ------------------------------------------------- | ------------------------------------------------------------ |
+| type                                              | data source type(available parameters:shardingSphereJdbc,jdbc)|
+| parameter                                         | data source parameter                                        |
+
+Parameter configuration:
+
+type = shardingSphereJdbc 
+
+| Parameter                                         | Describe                                                     |
+| ------------------------------------------------- | ------------------------------------------------------------ |
+| dataSource                                        | sharding sphere data source configuration                    |
+| rule                                              | sharding sphere data source table rule                       |
+
+type = jdbc 
+
+| Parameter                                         | Describe                                                     |
+| ------------------------------------------------- | ------------------------------------------------------------ |
+| name                                              | jdbc name                                                    |
+| ruleConfiguration.targetDataSources.jdbcUrl           | jdbc url                                                     |
+| ruleConfiguration.targetDataSources.username      | jdbc username                                                |
+| ruleConfiguration.targetDataSources.password      | jdbc password                                                |
 
 #### Example
 
@@ -747,52 +768,60 @@ curl -X POST \
   -H 'content-type: application/json' \
   -d '{
         "ruleConfiguration": {
-          "sourceDataSource":"
-            dataSources:
-              ds_0:
-                dataSourceClassName: com.zaxxer.hikari.HikariDataSource
-                props:
-                  driverClassName: com.mysql.jdbc.Driver
-                  jdbcUrl: jdbc:mysql://127.0.0.1:3306/scaling_0?useSSL=false
-                  username: scaling
-                  password: scaling
-              ds_1:
-                dataSourceClassName: com.zaxxer.hikari.HikariDataSource
-                props:
-                  driverClassName: com.mysql.jdbc.Driver
-                  jdbcUrl: jdbc:mysql://127.0.0.1:3306/scaling_1?useSSL=false
-                  username: scaling
-                  password: scaling
-            ",
-          "sourceRule":"
-            rules:
-            - !SHARDING
-              tables:
-                t_order:
-                  actualDataNodes: ds_$->{0..1}.t_order_$->{0..1}
-                  databaseStrategy:
-                    standard:
-                      shardingColumn: order_id
-                      shardingAlgorithmName: t_order_db_algorith
-                  logicTable: t_order
-                  tableStrategy:
-                    standard:
-                      shardingColumn: user_id
-                      shardingAlgorithmName: t_order_tbl_algorith
-              shardingAlgorithms:
-                t_order_db_algorith:
-                  type: INLINE
-                  props:
-                    algorithm-expression: ds_$->{order_id % 2}
-                t_order_tbl_algorith:
-                  type: INLINE
-                  props:
-                    algorithm-expression: t_order_$->{user_id % 2}
-            ",
-          "targetDataSources":{
-            "username":"root",
-            "password":"root",
-            "url":"jdbc:mysql://127.0.0.1:3307/sharding_db?serverTimezone=UTC&useSSL=false"
+          "source": {
+            "type": "shardingSphereJdbc",
+            "parameter": {
+              "dataSource":"
+                dataSources:
+                  ds_0:
+                    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+                    props:
+                      driverClassName: com.mysql.jdbc.Driver
+                      jdbcUrl: jdbc:mysql://127.0.0.1:3306/scaling_0?useSSL=false
+                      username: scaling
+                      password: scaling
+                  ds_1:
+                    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+                    props:
+                      driverClassName: com.mysql.jdbc.Driver
+                      jdbcUrl: jdbc:mysql://127.0.0.1:3306/scaling_1?useSSL=false
+                      username: scaling
+                      password: scaling
+                ",
+              "rule":"
+                rules:
+                - !SHARDING
+                  tables:
+                    t_order:
+                      actualDataNodes: ds_$->{0..1}.t_order_$->{0..1}
+                      databaseStrategy:
+                        standard:
+                          shardingColumn: order_id
+                          shardingAlgorithmName: t_order_db_algorith
+                      logicTable: t_order
+                      tableStrategy:
+                        standard:
+                          shardingColumn: user_id
+                          shardingAlgorithmName: t_order_tbl_algorith
+                  shardingAlgorithms:
+                    t_order_db_algorith:
+                      type: INLINE
+                      props:
+                        algorithm-expression: ds_$->{order_id % 2}
+                    t_order_tbl_algorith:
+                      type: INLINE
+                      props:
+                        algorithm-expression: t_order_$->{user_id % 2}
+                "
+            }
+          },
+          "target": {
+              "type": "jdbc",
+              "parameter": {
+                "username": "root",
+                "password": "root",
+                "jdbcUrl": "jdbc:mysql://127.0.0.1:3307/sharding_db?serverTimezone=UTC&useSSL=false"
+              }
           }
         },
         "jobConfiguration":{
diff --git a/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue b/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue
index 07119cc..0c75bf2 100644
--- a/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue
+++ b/shardingsphere-ui-frontend/src/views/data-scaling/module/index.vue
@@ -645,12 +645,20 @@ export default {
           const { username, password, url, jobCount } = this.form
           const params = {
             ruleConfiguration: {
-              sourceDataSource: this.textareaDatasource,
-              sourceRule: this.textareaRule,
-              targetDataSources: {
-                username,
-                password,
-                url
+              source: {
+                type: 'shardingSphereJdbc',
+                parameter: {
+                  dataSource: this.textareaDatasource,
+                  rule: this.textareaRule,
+                }
+              },
+              target: {
+                type: 'jdbc',
+                parameter: {
+                  username: username,
+                  password: password,
+                  jdbcUrl: url
+                }
               }
             },
             jobConfiguration: {