当前位置:主页 > 查看内容

创建集群 - 批量计算

发布时间:2021-09-20 00:00| 位朋友查看

简介:描述 创建一个 BatchCompute 集群。 请求语法 请求行: POST / clusters ? IdempotentToken = vU7xaM9YCqqAFHAVvRVynoMBZSgD0MPn HTTP / 1.1 请求方法为 POST ,请求资源为 clusters ,参数说明如下: 属性名称 类型 是否必须 描述 IdempotentToken string……

描述

创建一个 BatchCompute 集群。

请求语法

请求行:

  1. POST /clusters?IdempotentToken=vU7xaM9YCqqAFHAVvRVynoMBZSgD0MPn HTTP/1.1

请求方法为 POST ,请求资源为 clusters ,参数说明如下:

属性名称 类型 是否必须 描述
IdempotentToken string 用于保证请求的幂等性。由用户生成该参数值,要保证在不同请求间唯一,最大不值过64个字符,字符包括了字母、数字以及下划线。

请求数据:

请求数据以 JSON 格式描述:

  1. {
  2. "Name": "test-cluster",
  3. "Description": "demo",
  4. "InstanceType": "ecs.sn1ne.large",
  5. "ImageId": "img-ubuntu",
  6. "Bootstrap": "",
  7. "UserData": {
  8. "key2": "value2",
  9. "key1": "value1"
  10. },
  11. "EnvVars": {
  12. "key3": "value3",
  13. "key4": "value4"
  14. },
  15. "Notification": {
  16. "Topic": {
  17. "Name": "test-topic",
  18. "Endpoint": "http://[UserId].mns.[Region].aliyuncs.com/",
  19. "Events": [
  20. "OnClusterDeleted",
  21. "OnInstanceCreated",
  22. "OnInstanceActive"
  23. ]
  24. }
  25. },
  26. "Groups": {
  27. "group1": {
  28. "DesiredVMCount": 3,
  29. "InstanceType": "",
  30. "ResourceType": "OnDemand",
  31. "SpotStrategy": "",
  32. "SpotPriceLimit": 0.0
  33. }
  34. },
  35. "Configs": {
  36. "Disks": {
  37. "SystemDisk": {
  38. "Type": "cloud_efficiency",
  39. "Size": 50
  40. },
  41. "DataDisk": {
  42. "Type": "cloud_efficiency",
  43. "Size": 500,
  44. "MountPoint": "/home/my-data-disk"
  45. }
  46. },
  47. "Mounts": {
  48. "Locale": "GBK",
  49. "Lock": false,
  50. "CacheSupport": true,
  51. "CacheBlockSize": 262144,
  52. "CacheTotalSize": 536870912,
  53. "OSS": {
  54. "AccessKeyId": "[OSS Access Key Id]",
  55. "AccessKeySecret": "[OSS Access Key Id Secret]",
  56. "SecurityToken": ""
  57. },
  58. "Entries": [
  59. {
  60. "Source": "nas://26a174a62f-sfi98.cn-shenzhen.nas.aliyuncs.com:/",
  61. "Destination": "/home/admin/mydir1/",
  62. "WriteSupport": true
  63. },
  64. {
  65. "Source": "oss://my-test-bk/",
  66. "Destination": "/home/admin/mydir3/",
  67. "WriteSupport": false
  68. }
  69. ]
  70. },
  71. "Networks": {
  72. "VPC": {
  73. "VpcId": "[Your vpc id]",
  74. "CidrBlock": "192.168.0.0/16"
  75. },
  76. "Classic": {
  77. "AllowIpAddress": [],
  78. "AllowIpAddressEgress": [],
  79. "AllowSecurityGroup": [],
  80. "AllowSecurityGroupEgress": []
  81. }
  82. }
  83. }
  84. }

属性说明:

属性名称 类型 是否必须 描述
Name string 集群名称。长度为[2, 128]个英文或中文字符。必须以大小字母或中文开头,不能以 http:// 和https:// 开头。可以包含数字、半角冒号(:)、下划线(_)或者连字符(-)。
Description string 集群的描述信息。长度为[2, 256]个英文或中文字符。必须以大小字母或中文开头,不能以 http:// 和 https:// 开头。可以包含数字、半角冒号(:)、下划线(_)或者连字符(-)
InstanceType string 构建集群的实例类型。目前支持的ECS实例类型参阅 实例类型
ImageId string 镜像标识符。您可以使用官方定义的或自定义的镜像。可以通过 获取镜像列表 获取您可使用的所有镜像标识符。
DependencyIsvService string 执行程序依赖的阿里云提供的ISV服务,目前提供的ISV服务有:“GTX”,默认为空不依赖任何ISV服务。
Bootstrap string 实例启动运行的命令。您可以指定Bootstrap来初始化您的环境。Bootstrap 与 JOB 指定的程序运行命令有区别,JOB指定的程序是用来运行您的作业。
UserData map<string, string> 用户自定义的信息,您可以定义 map 的 key 和 value 值。用户程序使用 ECS 的 user server 获取。
EnvVars map<string, string> 虚拟机的环境变量,您可以定义 map 的 key 和 value 值。用户程序从环境变量中获取。
Groups map<string, object(GroupDesc)> 集群的实例组群信息。key 是您自定义的 group name, value 是 GroupDesc 类型。 一个集群可以包含多个实例组,实例组有数量限制,参阅 用户限额
Notification object(Notification) 用户指定消息通知配置。
Configs object(Configs) 集群的一些配置信息,比如实例的磁盘配置、网络和挂载路径。

返回信息

成功

状态行:

  1. HTTP/1.1 201 Created

响应数据:

  1. {
  2. "Id":"cls-6ki3sg6sqlno7nt8fu0007"
  3. }

属性说明:

属性名称 类型 是否必须 描述
Id string 作业标识符。每个集群都有唯一的集群标识符,你需要通过集群标识符来管理您的集群。

错误

错误响应格式请参阅 返回结果

创建集群特有的错误码:

状态码 错误码 错误信息 语义
400 IdempotentTokenMismatch Specified idempotent token mismatch. 说明该token已经被使用过,并且该请求参数与之前的请求不一样。
400 InvalidJsonFormat The request body has an invalid json format. 请求body是一个非法的json格式。
400 InvalidHttpBody Specified parameter HttpBody is not valid. Its type must be object. http body必须是一个object。
400 MissingName Name is mandatory for this action. 缺少Name参数。
400 MissingConfigs.Networks.VPC.OppositeRouterId Configs.Networks.VPC.OppositeRouterId is mandatory for this action. 缺少Configs.Networks.VPC.OppositeRouterId参数。
400 MissingConfigs.Networks.VPC.OppositeAccessPointId Configs.Networks.VPC.OppositeAccessPointId is mandatory for this action. 缺少Configs.Networks.VPC.OppositeAccessPointId参数。
400 MissingConfigs.Networks.VPC.OppositeRegionId Configs.Networks.VPC.OppositeRegionId is mandatory for this action. 缺少Configs.Networks.VPC.OppositeRegionId参数。
400 InvalidName Specified parameter Name is not valid. Its type must be string. Name必须是一个string。
400 InvalidName Specified parameter Name is not valid. Its length must be in [1, 64]. Name的长度必须在1与64之间。
400 InvalidName Specified parameter Name is not valid. It must only contain characters within [a-zA-Z0-9_-], and must not start with [0-9]. Name中只能包括字母数字和_-,但不能以数字开头。
400 InvalidDescription Specified parameter Description is not valid. Its type must be string. Description必须是一个string。
400 InvalidDescription Specified parameter Description is not valid. Its length must be in [0, 1024]. Description的长度必须在0与1024之间。
400 MissingImageId ImageId is mandatory for this action. 缺少ImageId参数。
400 InvalidImageId Specified parameter ImageId is not valid. Its type must be string. ImageId必须是一个string。
400 InvalidImageId Specified parameter ImageId is not valid. Its length must be in [1, 256]. ImageId的长度必须在1与256之间。
400 InvalidUserData Specified parameter UserData is not valid. Its type must be object. UserData必须是一个object。
400 InvalidUserData Specified parameter UserData is not valid. Its size must be in [0, 64]. UserData的大小必须在0与64之间。
400 InvalidUserData.{key} Specified parameter UserData.{key} is not valid. Its length must be in [1, 128]. UserData.{key}的大小必须在1与128之间。
400 InvalidUserData.{key}.value Specified parameter UserData.{key}.value is not valid. Its type must be string. UserData.{key}对应的Value必须是一个string。
400 InvalidUserData.{key}.value Specified parameter UserData.{key}.value is not valid. Its length must be in [0, 1024]. UserData.{key}对应的value的长度必须在0与1024之间。
400 InvalidGroups Specified parameter Groups is not valid. Its type must be object. Groups必须是一个object。
400 InvalidGroups.{key} Specified parameter Groups.{key} is not valid. Its type must be object. Groups.{key}必须是一个object。
400 InvalidGroups.{key} Specified parameter Groups.{key} is not valid. Its size must be in [1, 64]. Groups.{key}的大小必须在1与64之间。
400 MissingDesiredVMCount DesiredVMCount is mandatory for this action. 缺少DesiredVMCount参数。
400 InvalidDesiredVMCount Specified parameter DesiredVMCount is not valid. Its type must be integer. DesiredVMCount必须是一个integer。
400 InvalidDesiredVMCount Specified parameter DesiredVMCount is not valid. It must be in [1, 65536]. DesiredVMCount的大小必须在1与65536之间。
400 InvalidCidrBlock Specified parameter CidrBlock is not valid. Configs.Networks.VPC.CidrBlock is not valid. 无效的CidrBlock。
403 QuotaExhausted.MaxClusterCount The MaxClusterCount ({value}) quota is exhausted. Cluster数量不能超过{value}。
403 QuotaExhausted.MaxClusterGroupCount The MaxClusterGroupCount ({value}) quota is exhausted. 一个Cluster中的Group的数量不能超过{value}。
403 QuotaExhausted.MaxClusterGroupDesiredVMCount The MaxClusterGroupDesiredVMCount ({value}) quota is exhausted. 一个Cluster中的一个Group的DesiredVMCount不能超过{value}。
403 QuotaExhausted.Configs.Networks.VPC.OppositeRouterType The Configs.Networks.VPC.OppositeRouterType ({value}) is forbidden. Configs.Networks.VPC.OppositeRouterType不允许取值{value}。
400 MissingInstanceType InstanceType is mandatory for this action. 缺少InstanceType参数。
400 InvalidInstanceType Specified parameter InstanceType is not valid. InstanceType参数取值不合法。
400 MissingResourceType ResourceType is mandatory for this action. 缺少ResourceType参数。
400 InvalidResourceType Specified parameter ResourceType is not valid. ResourceType参数取值不合法。
400 Invalid{Parameter} Specified parameter {Parameter} is not valid. {Parameter}参数不合法。

本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文

  • 周排行
  • 月排行
  • 总排行

随机推荐