使用手册

    支持迁移场景如下:

    注意: 如果后端连接MySQL数据库,需要下载MySQL Connector/J, 解压缩后,将mysql-connector-java-5.1.47.jar拷贝到${sharding-scaling}\lib目录。

    API接口

    弹性迁移组件提供了简单的HTTP API接口

    创建迁移任务

    接口描述:POST /shardingscaling/job/start

    请求体:

    返回信息:

    1. "success": true,
    2. "errorCode": 0,
    3. "errorMsg": null,
    4. "model": null
    5. }

    查询迁移任务进度

    接口描述:GET /shardingscaling/job/progress/{jobId}

    示例:

    返回信息:

    1. {
    2. "success": true,
    3. "errorCode": 0,
    4. "errorMsg": null,
    5. "model": {
    6. "id": 1,
    7. "jobName": "Local Sharding Scaling Job",
    8. "status": "RUNNING/STOPPED"
    9. "syncTaskProgress": [{
    10. "id": "127.0.0.1-3306-test",
    11. "status": "PREPARING/MIGRATE_HISTORY_DATA/SYNCHRONIZE_REALTIME_DATA/STOPPING/STOPPED",
    12. "id": "history-test-t1#0",
    13. "estimatedRows": 41147,
    14. "syncedRows": 41147
    15. }, {
    16. "id": "history-test-t1#1",
    17. "syncedRows": 42917
    18. }, {
    19. "id": "history-test-t1#2",
    20. "estimatedRows": 43543,
    21. "syncedRows": 43543
    22. }, {
    23. "id": "history-test-t2#0",
    24. "estimatedRows": 39679,
    25. "syncedRows": 39679
    26. }, {
    27. "id": "history-test-t2#1",
    28. "estimatedRows": 41483,
    29. "syncedRows": 41483
    30. }, {
    31. "id": "history-test-t2#2",
    32. "estimatedRows": 42107,
    33. "syncedRows": 42107
    34. }],
    35. "realTimeSyncTaskProgress": {
    36. "delayMillisecond": 1576563771372,
    37. "logPosition": {
    38. "position": 177532875,
    39. "serverId": 0
    40. }
    41. }
    42. }]
    43. }
    44. }

    查询所有迁移任务

    接口描述:GET /shardingscaling/job/list

    返回信息:

    1. {
    2. "success": true,
    3. "errorCode": 0,
    4. "model": [
    5. {
    6. "jobId": 1,
    7. "jobName": "Local Sharding Scaling Job",
    8. "status": "RUNNING"
    9. }
    10. ]
    11. }

    停止迁移任务

    接口描述:POST /shardingscaling/job/stop

    请求体:

    示例:

    返回信息:

    1. {
    2. "success": true,
    3. "errorCode": 0,
    4. "errorMsg": null,
    5. }

    通过UI界面来操作

    更多信息请参考sharding-ui项目。