开发者社区> 问答> 正文

如何查看同步作业列表



描述


通过这个接口可以查询调用账号下所有同步作业的状态及同步详情。

请求参数

参数名称数据类型是否必须参数说明
ActionString系统默认参数,这个接口的接口定义,取值为:DescribeSynchronizationJobs
PageSizeInteger每页记录数,取值:30/50/100默认值:30
PageNumInteger页码,大于0,且不超过Integer的最大值,默认值:1


返回参数

参数名称数据类型参数说明
PageNumberInteger页码
TotalRecordCountInteger总实例数
PageRecordCountInteger本页同步实例数
SynchronizationInstancesList同步作业状态,其中 SynchronizationInstance的定义参考SynchronizationInstance参数定义


SynchronizationInstance 参数定义

参数名称数据类型参数说明
SynchronizationJobIdString同步实例ID
SynchronizationJobNameString同步实例名称
SynchronizationJobClassString同步实例规格
PayTypeString付费类型
ExpireTimeString到期时间,格式为:YYYY-MM-DDT hh:mm:ssZ,例如:2011-06-09T 12:11:11Z
SourceEndpointSourceEndpoint同步实例的源实例连接信息
DestinationEndpointDestinationEndpoint同步实例的目标实例连接信息
SynchronizationObjectsList同步对象
StructureInitializationString是否进行结构初始化
DataInitializationString是否进行全量数据初始化
StatusString同步实例状态,取值包括:NotStarted:未启动 Prechecking: 预检查中 PrecheckFailed: 预检查失败 Initializating : 同步初始化 InitializeFailed: 同步初始化失败Synchronizing : 同步中 Failed: 同步失败 Suspending: 暂停 Modifying: 同步中(同步对象变更中) Finished: 完成
ErrorMessageString同步失败原因
PrecheckStatusPrecheckStatus预检查状态,其中 PrecheckStatus的定义参考 PrecheckStatus 参数定义
StructureInitializationStatusStructureInitializationStatus结构初始化详情,其中 StructureInitializationStatus的定义参考StructureInitializationStatus参数定义
DataInitializationStatusDataInitializationStatus全量数据初始化详情,其中 DataInitializationStatus的定义参考DataInitializationStatus参数定义
DataSynchronizationStatusDataSynchronizationStatus增量初始化详情,其中 DataSynchronizationStatus的定义参考DataSynchronizationStatus参数定义
DelayString同步延迟,单位为秒
PerformanceString同步概况,其中 Performance的定义参考Performance参数定义


PrecheckStatus参数定义

参数名称数据类型参数说明
StatusString预检查状态
PercentString预检查进度,单位为百分比
DetailList各个预检查项的检查情况CheckItem的定义详见CheckItem的参数定义


CheckItem的参数定义

参数名称数据类型参数说明
ItemNameString检查项名称
CheckStatusString检查状态,取值包括NotStarted : 未启动 Checking : 检查中Failed : 检查失败Finished : 检查成功
ErrorMessageString失败原因
RepairMethodString修复方法


StructureInitializationStatus参数定义

参数名称数据类型参数说明
StatusString迁移状态,取值包括:NotStarted:未启动Migrating : 迁移中Failed :迁移失败Finished: 迁移完成
ErrorMessageString迁移失败原因
PercentString迁移进度,单位为百分比
ProgressString已经完成迁移的表数量


DataInitializationStatus参数定义

参数名称数据类型参数说明
StatusString迁移状态,取值包括:NotStarted:未启动Migrating : 迁移中Failed :迁移失败Finished: 迁移完成
ErrorMessageString迁移失败原因
PercentString迁移进度,单位为百分比
ProgressString已经完成迁移的表数量


DataSynchronizationStatus参数定义

参数名称数据类型参数说明
StatusString迁移状态,取值包括:NotStarted:未启动Migrating : 迁移中Failed :迁移失败Finished: 迁移完成
ErrorMessageString迁移失败原因
PercentString迁移进度,单位为百分比
DelayString迁移延迟,单位为秒


Performance 参数定义

参数名称数据类型参数说明
TPSString每秒同步的记录数
FlowString每秒同步的流量,单位为:MB/s


示例


下面简单演示通过JAVA SDK 查询同步任务列表的示例: public void descSyncJobs(DefaultAcsClient client) {
        DescribeSynchronizationJobsRequest request = new DescribeSynchronizationJobsRequest();
        DescribeSynchronizationJobsResponse response = new DescribeSynchronizationJobsResponse();
        try {
            response = client.getAcsResponse(request);
            System.out.println("Describe all Synchronization Jobs Succeed!");
            List<SynchronizationInstance> syncInstances=response.getSynchronizationInstances();
            System.out.println("Total num of Synchronization Jobs:"+syncInstances.size());
            for (SynchronizationInstance syncInstance : syncInstances) {
                System.out.println("SyncJobId:"+syncInstance.getSynchronizationJobId()
                        +"; SyncJobName:"+syncInstance.getSynchronizationJobName()
                        +"; PayType:"+syncInstance.getPayType()
                        +"; InstanceClass:"+syncInstance.getSynchronizationJobClass()
                        +"; StrucInit:"+syncInstance.getStructureInitialization()
                        +"; DataInit:"+syncInstance.getDataInitialization()
                        +"; Status:"+syncInstance.getStatus()
                        +"; ErrMSG:"+syncInstance.getErrorMessage()
                        +"; Delay:"+syncInstance.getDelay());
                System.out.println("SourceEndpointInstanceType:"+syncInstance.getSourceEndpoint().getInstanceType()
                        +"SourceEnpointInstanceId:"+syncInstance.getSourceEndpoint().getInstanceId());
                System.out.println("DestEndpointInstanceType:"+syncInstance.getDestinationEndpoint().getInstanceType()
                        +"DestEndpointInstanceId:"+syncInstance.getDestinationEndpoint().getInstanceId());
                // Get Precheck Status
                try {
                    com.aliyuncs.dts.model.v20160801.DescribeSynchronizationJobsResponse.SynchronizationInstance.PrecheckStatus precheckStatus = syncInstance.getPrecheckStatus();
                    System.out.println("Get Precheck Status for Sync Job Succeed");
                    System.out.println("Precheck Status:"+syncInstance.getPrecheckStatus().getStatus()
                            +"Precheck Percent:"+syncInstance.getPrecheckStatus().getPercent());
                    for (int j = 0; j < syncInstance.getPrecheckStatus().getDetail().size(); j++) {
                        System.out.println("CheckItem:"+syncInstance.getPrecheckStatus().getDetail().get(j).getCheckStatus()
                                +"; ErrorMSG:"+syncInstance.getPrecheckStatus().getDetail().get(j).getErrorMessage()
                                +"; RepairMethod:"+syncInstance.getPrecheckStatus().getDetail().get(j).getRepairMethod());
                    }
                } catch (Exception e) {
                    // TODO: handle exception
                    System.out.println("Get Precheck Status for Sync Job Failed");
                }
                // Get Structure Initialization Status
                try {
                    System.out.println("Get Structure Initialization Status Succeed!");
                    System.out.println("Structure Init Status:"+syncInstance.getStructureInitializationStatus().getStatus()
                            +"; Percent:"+syncInstance.getStructureInitializationStatus().getPercent()
                            +"; Progress:"+syncInstance.getStructureInitializationStatus().getProgress()
                            +"; ErrMSG:"+syncInstance.getStructureInitializationStatus().getErrorMessage());
                } catch (Exception e) {
                    // TODO: handle exception
                    System.out.println("Get Structure Initialization Status Failed!");
                }
                // Get Data Initialization Status
                try {
                    System.out.println("Get Data Init Status Succeed!");
                    System.out.println("Data Init Status:"+syncInstance.getDataInitializationStatus().getStatus()
                            +"; Percent:"+syncInstance.getDataInitializationStatus().getPercent()
                            +"; Progress:"+syncInstance.getDataInitializationStatus().getProgress()
                            +"; ErrMSG:"+syncInstance.getDataInitializationStatus().getErrorMessage());
                } catch (Exception e) {
                    // TODO: handle exception
                    System.out.println("Get Data Init Status Failed!");
                    System.out.println(e.toString());
                }
                //Get Data Synchronization Status
                try {
                    System.out.println("Get Data Synchronization Status Succeed!");
                    System.out.println("Data Sync Status:"+syncInstance.getDataSynchronizationStatus().getStatus()
                            +"; Percent:"+syncInstance.getDataSynchronizationStatus().getPercent()
                            +"; Delay:"+syncInstance.getDataSynchronizationStatus().getDelay()
                            +"; ErrMSG:"+syncInstance.getDataSynchronizationStatus().getErrorMessage());
                } catch (Exception e) {
                    // TODO: handle exception
                    System.out.println("Get Data Sync Status Failed!");
                    System.out.println(e.toString());
                }
            }
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("Desc all Sync Jobs Failed!");
            System.out.println(e.toString());
        }
    }

展开
收起
云栖大讲堂 2017-10-31 16:34:22 1979 0
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
MaxCompute Logview参数详解和问题排查(废弃) 立即下载
MaxCompute Logview参数详解和问题排查 立即下载
MaxCompute客户端 - odpscmd操作使用 立即下载