POST /api/login
Parameter | Field type | Essential | Describe |
---|---|---|---|
username | String | Y | User name |
password | String | Y | User password |
curl -X GET http://localhost:8088/api/login
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
accessToken | String | Access credentials |
username | String | User name |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": {"accessToken":"string","username":"string"} }
Note: accessToken is obtained. All subsequent requests need to carry this voucher in request headers: Access-Token: accessToken
GET /api/reg-center
curl -X GET http://localhost:8088/api/reg-center
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
name | String | Name of Registration Center |
registryCenterType | String | Registry type: “zookeeper” / “etcd” |
serverLists | String | Service address of Registration Center |
governanceName | String | Governance instance name |
digest | String | Permission token to connect to the registry |
additionalConfigCenterType | String | Additional config center type: “zookeeper” / “etcd” |
additionalConfigCenterServerList | String | Service address of additional config center |
additionalDigest | String | Permission token to connect to the additional config center |
activated | Boolean | Is it active |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": [ { "name": "string", "registryCenterType": "Zookeeper", "serverLists": "string", "governanceName": "string", "digest": "string", "additionalConfigCenterType": "Zookeeper", "additionalConfigCenterServerList": "string", "additionalDigest": "string", "activated": true }, { "name": "string", "registryCenterType": "Etcd", "serverLists": "string", "governanceName": "string", "digest": "string", "additionalConfigCenterType": "Zookeeper", "additionalConfigCenterServerList": "string", "additionalDigest": "string", "activated": false } ] }
POST /api/reg-center
curl -X POST http://localhost:8088/api/reg-center
Parameter | Field type | Essential | Describe |
---|---|---|---|
name | String | Y | Name of Registration Center |
governanceName | String | Y | Data governance instance name |
registryCenterType | String | Y | Registry type: “zookeeper” / “etcd” |
serverLists | String | Y | Service address of Registration Center |
digest | String | N | Permission token to connect to the registry |
additionalConfigCenterType | String | N | Additional config center type: “zookeeper” / “etcd” |
additionalConfigCenterServerList | String | N | Service address of additional config center |
additionalDigest | String | N | Permission token to connect to the additional config center |
{ "name": "string", "governanceName": "string", "registryCenterType": "Zookeeper", "serverLists": "string" "additionalConfigCenterType": "Zookeeper", "additionalConfigCenterServerList": "string" }
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": null }
DELETE /api/reg-center
Parameter | Field type | Essential | Describe |
---|---|---|---|
name | String | Y | Name of Registration Center |
{"name":"string"}
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
POST /api/reg-center/connect
Parameter | Field type | Essential | Describe |
---|---|---|---|
name | String | Y | Name of Registration Center |
{"name":"string"}
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
Note: after the registration center is activated successfully, subsequent configuration and governance operations can be performed. Only one active registry is allowed for the service.
GET /api/reg-center/activated
无
Parameter | Field type | 描述 |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
name | String | Name of Registration Center |
registryCenterType | String | Registry type: “zookeeper” / “etcd” |
serverLists | String | Service address of Registration Center |
governanceName | String | Data governance instance name |
digest | String | Permission token to connect to the registry |
additionalConfigCenterType | String | Additional config center type: “zookeeper” / “etcd” |
additionalConfigCenterServerList | String | Service address of additional config center |
additionalDigest | String | Permission token to connect to the additional config center |
activated | Boolean | Is it active |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": { "name": "string", "registryCenterType": "Zookeeper", "serverLists": "string", "governanceName": "string", "digest": "string", "additionalConfigCenterType": "Zookeeper", "additionalConfigCenterServerList": "string", "additionalDigest": "string", "activated": true } }
GET /api/schema
无
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
model | Collection | schema name list |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": ["sharding_order", "sharding_db", "primary_replica_db"] }
GET /api/schema/rule/{schemaName}
Parameter | Field type | Essential | Describe |
---|---|---|---|
schemaName | String | Y | schema name |
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
model | String | yaml string |
{"success":true,"errorCode":0,"errorMsg":null,"model":"yaml string"}
PUT /api/schema/rule/{schemaName}
Parameter | Field type | Essential | Describe |
---|---|---|---|
schemaName | String | Y | schema name |
ruleConfig | String | Y | yaml string |
{"ruleConfig":"yaml string"}
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
GET /api/schema/datasource/{schemaName}
Parameter | Field type | Essential | Describe |
---|---|---|---|
schemaName | String | Y | schema name |
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
model | String | yaml string |
{"success":true,"errorCode":0,"errorMsg":null,"model":"yaml string"}
PUT /api/schema/datasource/{schemaName}
Parameter | Field type | Essential | Describe |
---|---|---|---|
schemaName | String | Y | schema name |
Parameter | Field type | Essential | Describe |
---|---|---|---|
dataSourceConfig | String | Y | yaml string |
{"dataSourceConfig":"yaml string"}
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
GET /api/authentication
无
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
username | String | Login user name |
password | String | Login password |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": { "username": "string", "password": "string" } }
PUT /api/authentication
Parameter | Field type | Essential | Describe |
---|---|---|---|
username | String | Y | Login user name |
password | String | Y | Login password |
{"username":"string","password":"string"}
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
GET /api/properties
无
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
model | String | yaml string |
{"success":true,"errorCode":0,"errorMsg":null,"model":"yaml string"}
PUT /api/properties
Parameter | Field type | Essential | Describe |
---|---|---|---|
properties | String | Y | yaml string |
{"properties":"yaml string"}
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
GET /api/governance/instance
无
Response Body: (io.shardingsphere.shardingui.web.response.ResponseResult<java.util.Collection<io.shardingsphere.shardingui.common.dto.InstanceDTO>>
)
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
serverIp | String | IP |
instanceId | String | Instance ID |
enabled | Boolean | Instance ID enable status |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": [{ "serverIp": "string", "instanceId": "string", "enabled": true }] }
PUT /api/governance/instance
Parameter | Field type | Essential | Describe |
---|---|---|---|
instanceId | String | Y | Running instance ID |
enabled | Boolean | Y | Instance ID enabling status, true: enabled, false: Disabled |
{"instanceId":"string","enabled":false}
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
GET /api/governance/datasource
无
Response Body: (io.shardingsphere.shardingui.web.response.ResponseResult<java.util.Collection<io.shardingsphere.shardingui.common.dto.ReplicaDataSourceDTO>>
)
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
schema | String | Schema name |
primaryDataSourceName | String | The name of primary data source |
replicaDataSourceName | String | The name of replica data source |
enabled | Boolean | Enable status of replica data source |
{ "success": true, "errorCode": 0, "errorMsg": null, "model": [ { "schema": "primary_replica_db", "primaryDataSourceName": "primary_ds", "replicaDataSourceName": "replica_ds_0", "enabled": true }, { "schema": "primary_replica_db", "primaryDataSourceName": "primary_ds", "replicaDataSourceName": "replica_ds_1", "enabled": true } ] }
PUT /api/governance/datasource
Parameter | Field type | Essential | Describe |
---|---|---|---|
schema | String | Schema name | |
primaryDataSourceName | String | The name of primary data source | |
replicaDataSourceName | String | The name of replica data source | |
enabled | Boolean | Enable status of replica data source |
{ "schema": "primary_replica_db", "primaryDataSourceName": "primary_ds", "replicaDataSourceName": "replica_ds_0", "enabled": true }
Parameter | Field type | Describe |
---|---|---|
success | Boolean | Is the request successful |
errorCode | Integer | Error code |
errorMsg | String | Wrong description |
{"success":true,"errorCode":0,"errorMsg":null,"model":null}
GET /api/shardingscaling
curl -X GET http://localhost:8088/api/shardingscaling
{ "success": true, "errorCode": 0, "errorMsg": null, "model": { "serviceName": "scaling", "serviceType": "ShardingScaling", "serviceUrl": "localhost:8084" } } OR { "success": false, "errorCode": 0, "errorMsg": "No configured sharding scaling services", "model": null }
POST /api/shardingscaling
Parameter | Describe |
---|---|
serviceName | user defined name of service |
serviceType | Fixed value ShardingScaling |
serviceUrl | user defined url of service |
curl -X POST \ http://localhost:8088/api/shardingscaling \ -H 'content-type: application/json' \ -d '{ "serviceName": "scaling", "serviceType": "ShardingScaling", "serviceUrl": "localhost:8084" }'
{ "success": true, "errorCode": 0, "errorMsg": null, "model": null }
DELETE /api/shardingscaling
curl -X DELETE http://localhost:8088/api/shardingscaling
{ "success": true, "errorCode": 0, "errorMsg": null, "model": null }
POST /api/shardingscaling/job/start
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 |
curl -X POST \ http://localhost:8088/api/shardingscaling/job/start \ -H 'content-type: application/json' \ -d '{ "ruleConfiguration": { "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":{ "concurrency":"3" } }'
{ "success": true, "errorCode": 0, "errorMsg": null, "model": null }
GET /api/shardingscaling/job/progress/{jobId}
curl -X GET \ http://localhost:8088/api/shardingscaling/job/progress/1
{ "success": true, "errorCode": 0, "errorMsg": null, "model": { "id": 1, "jobName": "Local Sharding Scaling Job", "status": "RUNNING/STOPPED" "syncTaskProgress": [{ "id": "127.0.0.1-3306-test", "status": "PREPARING/MIGRATE_HISTORY_DATA/SYNCHRONIZE_REALTIME_DATA/STOPPING/STOPPED", "historySyncTaskProgress": [{ "id": "history-test-t1#0", "estimatedRows": 41147, "syncedRows": 41147 }, { "id": "history-test-t1#1", "estimatedRows": 42917, "syncedRows": 42917 }, { "id": "history-test-t1#2", "estimatedRows": 43543, "syncedRows": 43543 }, { "id": "history-test-t2#0", "estimatedRows": 39679, "syncedRows": 39679 }, { "id": "history-test-t2#1", "estimatedRows": 41483, "syncedRows": 41483 }, { "id": "history-test-t2#2", "estimatedRows": 42107, "syncedRows": 42107 }], "realTimeSyncTaskProgress": { "id": "realtime-test", "delayMillisecond": 1576563771372, "logPosition": { "filename": "ON.000007", "position": 177532875, "serverId": 0 } } }] } }
GET /api/shardingscaling/job/list
curl -X GET \ http://localhost:8088/api/shardingscaling/job/list
{ "success": true, "errorCode": 0, "model": [ { "jobId": 1, "jobName": "Local Sharding Scaling Job", "status": "RUNNING" } ] }
POST /api/shardingscaling/job/stop
Parameter | Describe |
---|---|
jobId | job id |
curl -X POST \ http://localhost:8088/api/shardingscaling/job/stop \ -H 'content-type: application/json' \ -d '{ "jobId":1 }'
{ "success": true, "errorCode": 0, "errorMsg": null, "model": null }