文档首页/ 数据复制服务 DRS/ API参考/ 应用示例/ 场景二:批量查询任务详情
更新时间:2024-07-11 GMT+08:00

场景二:批量查询任务详情

场景描述

本章节指导用户通过调用批量查询任务详情,查询租户下所有任务详情。

操作步骤

  1. 参考认证鉴权,通过调用IAM服务的API,获取用户的Token。
  2. 参考获取任务ID,获取需要查询的任务ID。
  3. URI格式: /v3/{project_id}/jobs/batch-detail

    • 请求示例:

      POST: https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-detail

      {endpoint}信息请从地区和终端节点获取。

    • 请求样例:
      https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-detail
      
      {
        "jobs" : [ "24834eb6-be30-464e-a299-f7aa730jb101", "140b5236-88ad-43c8-811c-1268453jb101" ],
        "page_req" : {
          "cur_page" : 1,
          "per_page" : 10
        }
      }
    • 响应示例:
      {
        "count" : 2,
        "results" : [ {
          "id" : "24834eb6-be30-464e-a299-f7aa730jb101",
          "name" : "DRS-3999-lws",
          "status" : "STARTJOBING",
          "description" : "",
          "create_time" : "1608519469412",
          "task_type" : "FULL_INCR_TRANS",
          "source_endpoint" : {
            "ip" : "172.22.74.56",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "db_user" : "root"
          },
          "target_endpoint" : {
            "ip" : "172.21.176.219",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "inst_id" : "3ef57dbcc8db478a9e346d26ef2575bfin01",
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "inst_name" : "rds-lws-target",
            "db_user" : "root",
            "vpc_id" : "0ff8df7b-f0e9-4b16-ac16-1db3dacb69e4",
            "subnet_id" : "f857d371-2f03-4622-85f6-2b7d42d0d82c"
          },
          "inst_info" : {
            "ip" : "172.16.213.101",
            "inst_type" : "high",
            "engine_type" : "mysql",
            "volume_size" : 100,
            "public_ip" : "******",
            "start_time" : "0"
          },
          "actual_start_time" : "1608520069393",
          "update_time" : "1608520068979",
          "job_direction" : "up",
          "db_use_type" : "migration",
          "need_restart" : false,
          "is_target_readonly" : true,
          "speed_limit" : [ ],
          "schema_type" : "Tungsten",
          "object_switch" : true,
          "replace_definer" : true,
          "migrate_user" : false,
          "az_code" : "az2xahz",
          "vpc_id" : "0ff8df7b-f0e9-4b16-ac16-1db3dacb69e4",
          "subnet_id" : "f857d371-2f03-4622-85f6-2b7d42d0d82c",
          "security_group_id" : "d90c971b-4b9d-402c-9c59-5c239389b8dd",
          "support_ip_v6" : false,
          "original_job_direction": "up",
          "is_open_fast_clean": true,
          "object_infos":[{
            "id":"test",
            "type":"database",
            "name":"test",
            "select":"true"
            },{
            "id":"test-*-*-table01",
            "type":"table",
            "name":"table01",
            "select":"true",
            "parent_id":"test"
            }]
        }, {
          "id" : "140b5236-88ad-43c8-811c-1268453jb101",
          "name" : "DRS-0042-linxiaolu",
          "status" : "CONFIGURATION",
          "description" : "",
          "create_time" : "1608366204171",
          "task_type" : "FULL_INCR_TRANS",
          "source_endpoint" : {
            "ip" : "192.168.0.27",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "db_user" : "root"
          },
          "target_endpoint" : {
            "ip" : "192.168.0.131",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "inst_id" : "e05a3679efe241d8b5dee80b17c1a863in01",
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "inst_name" : "rds-1417-lxl",
            "db_user" : "root",
            "vpc_id" : "65f0391c-0582-44a6-aa50-248f97ed82e1",
            "subnet_id" : "352ad828-3467-4f03-987a-c55a5a9dd417"
          },
          "inst_info" : {
            "ip" : "192.168.0.229",
            "status" : "ACTIVE",
            "inst_type" : "high",
            "engine_type" : "mysql",
            "volume_size" : 100,
            "public_ip" : "10.154.219.72",
            "start_time" : "0"
          },
          "actual_start_time" : "1608369232412",
          "full_transfer_complete_time" : "1608369510202",
          "update_time" : "1608517066434",
          "job_direction" : "up",
          "db_use_type" : "migration",
          "need_restart" : false,
          "is_target_readonly" : true,
          "speed_limit" : [ ],
          "schema_type" : "Tungsten",
          "object_switch" : false,
          "replace_definer" : true,
          "migrate_user" : false,
          "tags": [{
             "key1" : "value1",
             "key2" : "value2"
           }],
          "az_code" : "az2xahz",
          "vpc_id" : "65f0391c-0582-44a6-aa50-248f97ed82e1",
          "subnet_id" : "352ad828-3467-4f03-987a-c55a5a9dd417",
          "security_group_id" : "d90c971b-4b9d-402c-9c59-5c239389b8dd",
          "support_ip_v6" : false,
          "original_job_direction": "up",
          "object_infos":[{
            "id":"test2",
            "type":"database",
            "name":"test2",
            "select":"true"
            },{
            "id":"test2-*-*-table02",
            "type":"table",
            "name":"table02",
            "select":"true",
            "parent_id":"test2"
            }]
        } ],
          "data_transformation": {
            "total_count": 2,
              "filter_conditions": [
                {
                  "data_transformation_object_infos": [
                    {
                      "id": "test02-*-*-table02-*-*---conditionFilter--",
                        "db_name": "test02",
                        "table_name": "table02",
                        "data_transformation_type": "contentConditionalFilter"
                     }
                   ],
                   "transformation_info": {
                     "value": "id1<1",
                       "transformation_type": "contentConditionalFilter"
                   }
                 },
                 {
                   "data_transformation_object_infos": [
                     {
                       "id": "test02-*-*-table01-*-*---configConditionFilter--",
                       "db_name": "test02",
                       "table_name": "test01",
                       "data_transformation_type": "configConditionalFilter"
                      }
                    ],
                    "transformation_info": {
                      "value": "config",
                      "transformation_type": "configConditionalFilter"
                    },
                    "config_transformation": {
                      "indexs": "id",
                      "values": "id <= 6",
                      "db_table_name": "test02.table01",
                      "db_name": "test02",
                      "table_name": "table01",
                      "col_names": "id",
                      "prim_key_or_index": "id"
                     }
                  }
               ]
           }
      }