云服务器内容精选

  • 响应示例 状态码: 200 成功响应示例 Http Status Code: 200 { } 状态码: 400 失败响应示例 Http Status Code: 400 { "errorMessage": "can not find job to cancel, id is 9440a7ebXXXXXXXXXXXXXXXXXXXX2d079a67001679122", "errorCode": "GES.8303" }
  • 数据规划 发布者Job使用自定义算子每秒钟产生10000条数据。 数据包含两个属性:分别是Int和String类型。 配置文件 nettyconnector.registerserver.topic.storage:设置NettySink的IP、端口及并发度信息在第三方注册服务器上的路径(必填),例如: nettyconnector.registerserver.topic.storage: /flink/nettyconnector nettyconnector.sinkserver.port.range:设置NettySink的端口范围(必填),例如: nettyconnector.sinkserver.port.range: 28444-28943 nettyconnector.ssl.enabled:设置NettySink与NettySource之间通信是否SSL加密(默认为false),例如: nettyconnector.ssl.enabled: true nettyconnector.sinkserver.subnet:设置网络所属域,例如: nettyconnector.sinkserver.subnet: 10.162.0.0/16 安全认证配置: Zookeeper的SASL认证,依赖“flink-conf.yaml”中有关HA的相关配置,具体配置请参见配置管理Flink。 SSL的keystore、truststore、keystore password、truststore password以及password等也使用“flink-conf.yaml”的相关配置,具体配置请参见安装客户端并准备安全认证。 接口说明 注册服务器接口 注册服务器用来保存NettySink的IP、端口以及并发度信息,以便NettySource连接使用。为用户提供以下接口: public interface RegisterServerHandler { /** * 启动注册服务器 * @param configuration Flink的Configuration类型 */ void start(Configuration configuration) throws Exception; /** *注册服务器上创建Topic节点(目录) * @param topic topic节点名称 */ void createTopicNode(String topic) throw Exception; /** *将信息注册到某个topic节点(目录)下 * @param topic 需要注册到的目录 * @param registerRecord 需要注册的信息 */ void register(String topic, RegisterRecord registerRecord) throws Exception; /** *删除topic节点 * @param topic 待删除topic */ void deleteTopicNode(String topic) throws Exception; /** *注销注册信息 *@param topic 注册信息所在的topic *@param recordId 待注销注册信息ID */ void unregister(String topic, int recordId) throws Exception; /** * 查寻信息 * @param 查询信息所在的topic *@recordId 查询信息的ID */ RegisterRecord query(String topic, int recordId) throws Exception; /** * 查询某个Topic是否存在 * @param topic */ Boolean isExist(String topic) throws Exception; /** *关闭注册服务器句柄 */ void shutdown() throws Exception; 工程基于以上接口提供了ZookeeperRegisterHandler供用户使用。 NettySink算子 Class NettySink(String name, String topic, RegisterServerHandler registerServerHandler, int numberOfSubscribedJobs) name:为本NettySink的名称。 topic:为本NettySink产生数据的Topic,每个不同的NettySink(并发度除外)必须使用不同的TOPIC,否则会引起订阅混乱,数据无法正常分发。 registerServerHandler:为注册服务器的句柄。 numberOfSubscribedJobs:为订阅本NettySink的作业数量,该数量必须是明确的,只有当所有订阅者都连接上NettySink,NettySink才发送数据。 NettySource算子 Class NettySource(String name, String topic, RegisterServerHandler registerServerHandler) name:为本NettySource的名称,该NettySource必须是唯一的(并发度除外),否则,连接NettySink时会出现冲突,导致无法连接。 topic:订阅的NettySink的topic。 registerServerHandler:为注册服务器的句柄。 NettySource的并发度必须与NettySink的并发度相同,否则无法正常创建连接。
  • URI GET /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/{job_id}/status?offset=offset&limit=limit 表1 路径参数 参数 是否必选 类型 说明 project_id 是 String 项目ID。获取方法请参见获取项目ID。 job_id 是 String Job ID offset 否 Integer 本次查询偏移量,默认为0。 limit 否 Integer 本次查询返回最大数量(最大100000),默认为100000。
  • 响应参数 表2 响应Body参数说明 参数 类型 说明 errorMessage String 系统提示信息。 执行成功时,字段可能为空。 执行失败时,用于显示错误信息。 errorCode String 系统提示信息。 执行成功时,字段可能为空。 执行失败时,用于显示错误码。 status String 查询成功时返回任务状态,包括以下四种状态: pending:等待中 running:运行中 success:成功 failed:失败 查询失败时字段为空。 data Object 算法运行的结果。查询失败时字段为空。 表3 data参数说明 参数 类型 说明 vertices List 点上关联的算法结果。 edges List 边上关联的算法结果。 outputs Object 其他输出结果。 data_return_size Integer 本次查询返回结果数量。 data_offset Integer 本次查询返回结果偏移量。 data_total_size Integer 异步任务产生的结果数据总量。
  • 响应示例 状态码: 200 成功响应示例 Http Status Code: 200 { "data": { "outputs": { "data_return_size": 2, "vertices": [ { "id": "Sarah", "label": "user", "properties": { "Occupation": [ "other or not specified" ], "Name": [ "莎拉" ], "Zip-code": [ "55105" ], "Gender": [ "F" ], "Age": [ "18-24" ] } }, { "id": "Sidney", "label": "user", "properties": { "Occupation": [ "writer" ], "Name": [ "西德尼" ], "Zip-code": [ "85296" ], "Gender": [ "M" ], "Age": [ "18-24" ] } } ], "data_offset": 0, "data_total_size": 19 } }, "status": "success" }
  • 响应示例 状态码: 200 成功响应。 { "id" : "575768277444198400", "job_type" : "CREATE_SERVER", "begin_time" : "2023-06-06T02:30:06.836Z", "end_time" : "2023-06-06T02:45:49.577Z", "status" : "SUCCESS", "sub_jobs_total" : 1, "sub_jobs" : [ { "id" : "575768277481947136", "job_type" : "CREATE_SERVER", "job_resource_info" : { "resource_id" : "a2a6f5af-cbf7-4242-8988-109426870886", "resource_name" : "APS-20230606023006-YM08IXT04C" }, "begin_time" : "2023-06-06T02:30:06.902Z", "end_time" : "2023-06-06T02:45:49.564Z", "status" : "SUCCESS", "error_code" : "", "error_message" : "", "project_id" : "a4da8115c9d8464ead3a38309130523f", "job_id" : "575768277444198400" } ] }
  • 响应示例 状态码: 200 OK { "status" : "RUNNING", "entities" : { "volume_id" : "bdf1bb37-f20f-4266-9a04-f43e0a127376" }, "job_id" : "4010a32d535527910153552b492c0002", "job_type" : "createVolume", "begin_time" : "2016-03-08T07:40:13.219Z", "end_time" : "" } 状态码: 400 Bad Request { "error" : { "message" : "XXXX", "code" : "XXX" } }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 status String job的状态。SUCCESS:成功。RUNNING:运行中。FAIL:失败。INIT:正在初始化。WAITING_EXECUTE:等待执行。 枚举值: SUCCESS RUNNING FAIL INIT WAITING_EXECUTE entities JobEntities object job的响应信息。 job_id String job的ID。 job_type String job的类型。 createVolume:创建单个云硬盘。 batchCreateVolume:批量创建云硬盘。 deleteVolume:删除单个云硬盘。 extendVolume:扩容云硬盘。 bulkDeleteVolume:批量删除云硬盘。 deleteSingleVolume:批量删除时逐个删除单个云硬盘。 retypeVolume:对云硬盘做硬盘类型变更。 begin_time String 开始时间。 end_time String 结束时间。 error_code String job执行失败时的错误码。 fail_reason String job执行失败时的错误原因。 表4 JobEntities 参数 参数类型 描述 volume_type String 云硬盘的类型。 size Integer 云硬盘的容量,单位为GiB。 volume_id String 云硬盘的ID。 name String 云硬盘的名称。 sub_jobs Array of SubJob objects 子Job的信息。当存在子Job信息时,entities中的其他字段将不会返回。 表5 SubJob 参数 参数类型 描述 status String 子job的状态。SUCCESS:成功。RUNNING:运行中。FAIL:失败。INIT:正在初始化。 枚举值: SUCCESS RUNNING FAIL INIT entities SubJobEntities object 子job的响应信息。 job_id String 子job的ID。 job_type String 子job的类型。 createVolume:创建单个云硬盘。 batchCreateVolume:批量创建云硬盘。 deleteVolume:删除单个云硬盘。 extendVolume:扩容云硬盘。 bulkDeleteVolume:批量删除云硬盘。 deleteSingleVolume:批量删除时逐个删除单个云硬盘。 retypeVolume:对云硬盘做硬盘类型变更。 begin_time String 开始时间。 end_time String 结束时间。 error_code String 子job执行失败时的错误码。 fail_reason String 子job执行失败时的错误原因。 表6 SubJobEntities 参数 参数类型 描述 volume_type String 云硬盘的类型。 size Integer 云硬盘的容量,单位为GiB。 volume_id String 云硬盘的ID。 name String 云硬盘的名称。 状态码: 400 表7 响应Body参数 参数 参数类型 描述 error Error object 出现错误时,返回的错误码。错误码和其对应的含义请参考错误码说明。 表8 Error 参数 参数类型 描述 code String 出现错误时,返回的错误码。错误码和其对应的含义请参考错误码说明。 message String 出现错误时,返回的错误消息。
  • 响应示例 状态码: 200 OK { "apiVersion" : "batch/v1", "kind" : "Job", "metadata" : { "creationTimestamp" : "2018-09-05T01:10:59Z", "labels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4", "job-name" : "pi" }, "name" : "pi", "namespace" : "namespace-test", "resourceVersion" : "5391205", "selfLink" : "/apis/batch/v1/namespaces/namespace-test/jobs/pi/status", "uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4" }, "spec" : { "backoffLimit" : 6, "completions" : 1, "parallelism" : 1, "selector" : { "matchLabels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4" } }, "template" : { "metadata" : { "annotations" : { "cri.cci.io/container-type" : "secure-container" }, "creationTimestamp" : null, "labels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4", "job-name" : "pi" }, "name" : "pi" }, "spec" : { "containers" : [ { "command" : [ "perl", "-Mbignum=bpi", "-wle", "print bpi(2000)" ], "image" : "perl", "imagePullPolicy" : "Always", "name" : "pi", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1Gi" }, "requests" : { "cpu" : "500m", "memory" : "1Gi" } }, "terminationMessagePath" : "/dev/termination-log", "terminationMessagePolicy" : "File" } ], "dnsPolicy" : "ClusterFirst", "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "restartPolicy" : "Never", "schedulerName" : "default-scheduler", "securityContext" : { } } } }, "status" : { "active" : 1, "startTime" : "2018-09-05T01:10:59Z" } }
  • URI GET /apis/batch/v1/namespaces/{namespace}/jobs/{name}/status 表1 路径参数 参数 是否必选 参数类型 描述 name 是 String name of the Job namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 pretty 否 String If 'true', then the output is pretty printed.
  • 状态码 状态码 描述 200 OK 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • 响应示例 状态码: 200 OK { "apiVersion" : "batch/v1", "items" : [ { "metadata" : { "creationTimestamp" : "2018-09-05T01:10:59Z", "labels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4", "job-name" : "pi" }, "name" : "pi", "namespace" : "namespace-test", "resourceVersion" : "5391205", "selfLink" : "/apis/batch/v1/namespaces/namespace-test/jobs/pi", "uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4" }, "spec" : { "backoffLimit" : 6, "completions" : 1, "parallelism" : 1, "selector" : { "matchLabels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4" } }, "template" : { "metadata" : { "annotations" : { "cri.cci.io/container-type" : "secure-container" }, "creationTimestamp" : null, "labels" : { "controller-uid" : "8c923079-b0a8-11e8-8bcb-f898ef6c78b4", "job-name" : "pi" }, "name" : "pi" }, "spec" : { "containers" : [ { "command" : [ "perl", "-Mbignum=bpi", "-wle", "print bpi(2000)" ], "image" : "perl", "imagePullPolicy" : "Always", "name" : "pi", "resources" : { "limits" : { "cpu" : "500m", "memory" : "1Gi" }, "requests" : { "cpu" : "500m", "memory" : "1Gi" } }, "terminationMessagePath" : "/dev/termination-log", "terminationMessagePolicy" : "File" } ], "dnsPolicy" : "ClusterFirst", "imagePullSecrets" : [ { "name" : "imagepull-secret" } ], "restartPolicy" : "Never", "schedulerName" : "default-scheduler", "securityContext" : { } } } }, "status" : { "active" : 1, "startTime" : "2018-09-05T01:10:59Z" } } ], "kind" : "JobList", "metadata" : { "resourceVersion" : "5391600", "selfLink" : "/apis/batch/v1/namespaces/namespace-test/jobs" } }
  • 状态码 状态码 描述 200 OK 400 BadRequest 401 Unauthorized 403 Forbidden 404 NotFound 405 MethodNotAllowed 406 NotAcceptable 409 Conflict 415 UnsupportedMediaType 422 Invalid 429 TooManyRequests 500 InternalError 503 ServiceUnavailable 504 ServerTimeout
  • URI GET /apis/batch/v1/namespaces/{namespace}/jobs 表1 路径参数 参数 是否必选 参数类型 描述 namespace 是 String object name and auth scope, such as for teams and projects 表2 Query参数 参数 是否必选 参数类型 描述 allowWatchBookmarks 否 Boolean allowWatchBookmarks requests watch events with type "BOOKMARK". Servers that do not implement bookmarks may ignore this flag and bookmarks are sent at the server's discretion. Clients should not assume bookmarks are returned at any specific interval, nor may they assume the server will send any BOOKMARK event during a session. If this is not a watch, this field is ignored. If the feature gate WatchBookmarks is not enabled in apiserver, this field is ignored. continue 否 String The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the "next key". This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications. fieldSelector 否 String A selector to restrict the list of returned objects by their fields. Defaults to everything. labelSelector 否 String A selector to restrict the list of returned objects by their labels. Defaults to everything. limit 否 Integer limit is a maximum number of responses to return for a list call. If more items exist, the server will set the continue field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true. The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned. resourceVersion 否 String resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset resourceVersionMatch 否 String resourceVersionMatch determines how resourceVersion is applied to list calls. It is highly recommended that resourceVersionMatch be set for list calls where resourceVersion is set See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details. Defaults to unset timeoutSeconds 否 Integer Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity. watch 否 Boolean Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion. pretty 否 String If 'true', then the output is pretty printed.
  • 响应参数 参数 参数类型 描述 status String Job的状态。 SUCCESS:成功 RUNNING:运行中 FAIL:失败 INIT:正在初始化 PENDING_PAYMENT:包年/包月订单待支付 entities Object Job操作的对象。请参见表2。 根据不同Job类型,显示不同的内容。裸金属服务器相关操作显示server_id;网卡相关操作显示nic_id;有子Job时为子Job的详情。 job_id String Job ID。 job_type String Job的类型,包含以下类型: baremetalBatchCreate:批量创建裸金属服务器 baremetalBatchOperate:批量修改裸金属服务器电源状态 baremetalVolumeBootReinstallOs:重装快速发放裸金属服务器操作系统 baremetalReinstallOs:重装本地盘裸金属服务器操作系统 baremetalAttachVolume:挂载单个磁盘 baremetalDetachVolume:卸载单个磁盘 begin_time String 开始时间。 时间戳格式为ISO 8601,例如:2019-04-25T20:04:47.591Z end_time String 结束时间。 时间戳格式为ISO 8601,例如:2019-04-26T20:04:47.591Z error_code String Job执行失败时的错误码。 fail_reason String Job执行失败时的错误原因。 message String 出现错误时,返回的错误消息。 code String 出现错误时,返回的错误码。 错误码和其对应的含义请参考状态码。 表2 entities字段数据结构说明 参数 参数类型 描述 sub_jobs_total Integer 子任务数量。没有子任务时为0。 sub_jobs Array of objects 每个子任务的执行信息。没有子任务时为空列表。请参见表3。 表3 sub_jobs字段数据结构说明 参数 参数类型 描述 status String Job的状态。 SUCCESS:成功 RUNNING:运行中 FAIL:失败 INIT:正在初始化 entities Object Job操作的对象。根据不同Job类型,显示不同的内容。裸金属服务器相关操作显示server_id;网卡相关操作显示nic_id。 请参见表4。 job_id String Job ID。 job_type String Job的类型,包含以下类型: baremetalSingleCreate:创建单个裸金属服务器 baremetalSingleOperate:修改单个裸金属服务器电源状态 begin_time String 开始时间。 时间戳格式为ISO 8601,例如:2019-04-25T20:04:47.591Z end_time String 结束时间。 时间戳格式为ISO 8601,例如:2019-04-26T20:04:47.591Z error_code String Job执行失败时的错误码。 fail_reason String Job执行失败时的错误原因。 message String 出现错误时,返回的错误消息。 code String 出现错误时,返回的错误码。 错误码和其对应的含义请参考状态码。 表4 entities字段数据结构说明 参数 参数类型 描述 server_id String 裸金属服务器相关操作显示server_id。 nic_id String 网卡相关操作显示nic_id。