Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Distributed Cache Service/ API Reference/ Examples/ Common Issues of Creating DCS Instances Using an API

Common Issues of Creating DCS Instances Using an API

Updated on 2024-03-05 GMT+08:00

This topic describes common issues that may occur when you create DCS instances using APIs.

Table 1 Common issues of creating DCS instances

Issue

Solution

Setting the Replica Quantity When Purchasing an Instance Using an API

If an instance is purchased using an API, its replica quantity is determined by the spec_code parameter specified during the purchase. The replica quantity is the value of replica_count in the example response provided in Querying Product Flavors.

Obtaining the Subnet ID

Use an API to obtain the correct subnet ID when creating an instance.

Insufficient AZ Resources During Instance Purchase

If resources in an AZ are insufficient, instance creation in the AZ will fail. You can use the value of flavors_available_zones.az_codes to ensure that the AZ you use has sufficient resources, as shown in the example response in Querying Product Flavors.

Querying Resource Quotas

Call the API described in Querying the Tenant Quotas. The value of quota indicates the maximum number of instances that can be created and the maximum allowed total memory.

Setting the Replica Quantity When Purchasing an Instance Using an API

If an instance is purchased using an API, its replica quantity is determined by the spec_code parameter specified during the purchase. The number of replicas is the value of replica_count in the example response of the Querying Product Flavors API.

Example request:

GET https://{dcs_endpoint}/v2/flavors?cache_mode={cache_mode}&engine={engine}&engine_version={engine_version}&cpu_type={cpu_type}&capacity={capacity}

Example response:

{
 "flavors": [
  {
   "dec": false,
   "spec_code": "redis.ha.xu1.large.r4.2",
   "cloud_service_type_code": "hws.service.type.dcs",
   "cloud_resource_type_code": "hws.resource.type.dcs3",
   "cache_mode": "ha",
   "engine": "redis",
   "engine_version": "4.0;5.0",
   "product_type": "generic",
   "cpu_type": "x86_64",
   "storage_type": "DRAM",
   "capacity": [
    "2"
   ],
   "billing_mode": [
    "Hourly",
    "Monthly",
    "Yearly"
   ],
   "tenant_ip_count": 4,
   "pricing_type": "normal",
   "is_dec": false,
   "attrs": [
    {
     "capacity": "2",
     "name": "max_memory",
     "value": "2"
    },
    {
     "capacity": "2",
     "name": "max_connections",
     "value": "50000"
    },
    {
     "capacity": "2",
     "name": "sharding_num",
     "value": "1"
    },
    {
     "capacity": "2",
     "name": "proxy_num",
     "value": "0"
    },
    {
     "capacity": "2",
     "name": "db_number",
     "value": "256"
    },
    {
     "capacity": "2",
     "name": "max_clients",
     "value": "10000"
    },
    {
     "capacity": "2",
     "name": "max_bandwidth",
     "value": "128"
    }
   ],
   "flavors_available_zones": [
    {
     "capacity": "2",
     "unit": "GB",
     "available_zones": [
      "a0865121f83b41cbafce65930a22a6e8",
      "15dcd3f789cb4fc088dbdece9c5eb547",
      "2dcb154ac2724a6d92e9bcc859657c1e",
      "effdcbc7d4d64a02aa1fa26b42f56533"
     ],
     "az_codes": [
      "xx-xx-xx1",
      "xx-xx-xx2",
      "xx-xx-xx3",
      "xx-xx-xx4"
     ]
    }
   ],
   "replica_count": 4,
   "inquery_spec_code": null
  }
 ]
}
NOTE:

When purchasing an instance, ensure that the value of spec_code corresponds to the value of capacity.

Obtaining the Subnet ID

When purchasing an instance, configure the correct subnet ID so that you can successfully connect to the instance. You can obtain the subnet ID using GET /v1/{project_id}/subnets?{vpc_id}. vpc_id can be obtained using the GET /v1/{project_id}/vpcs API.

Example request for obtaining vpc_id:

GET https://{vpc_endpoint}/v1/7d80ae32f57b499eb8781f9a9f57c538/vpcs

To obtain the value of {vpc_endpoint}, see Regions and Endpoints.

Example response for obtaining vpc_id:

{
	"vpcs": [{
		"id": "743bf021-2c2d-4511-aeac-85bd48c06af7",
		"name": "vpc-d2d4",
		"description": "",
		"cidr": "192.168.0.0/16",
		"status": "OK",
		"routes": [],
		"enterprise_project_id": "0"
	}]
}

Example request for obtaining the subnet ID:

GET https://{vpc_endpoint}/v1/7d80ae32f57b499eb8781f9a9f57c538/subnets?vpc_id=743bf021-2c2d-4511-aeac-85bd48c06af7

Example response for obtaining the subnet ID:

{
	"subnets": [{
		"id": "b0d6e0ac-fcce-4e11-a4a6-707e851ae1c3",
		"name": "subnet-d2e4",
		"description": "",
		"cidr": "192.168.0.0/24",
		"dnsList": ["100.125.1.250",
		"100.125.129.250"],
		"status": "ACTIVE",
		"vpc_id": "743bf021-2c2d-4511-aeac-85bd48c06af7",
		"ipv6_enable": false,
		"gateway_ip": "192.168.0.1",
		"dhcp_enable": true,
		"primary_dns": "100.125.1.250",
		"secondary_dns": "100.125.129.250",
		"availability_zone": "xxxxxx",
		"neutron_network_id": "b0d6e0ac-fcce-4e11-a4a6-707e851ae1c3",
		"neutron_subnet_id": "3d4ccce0-cadc-4af4-8c21-14d2857ffe5e",
		"extra_dhcp_opts": []
	}]
}

Insufficient AZ Resources During Instance Purchase

When purchasing an instance, if you want to check whether resources of a flavor are sufficient in an AZ, you can call the API described in Querying Product Flavors to view details about the AZs where the flavor is available and determine the AZs that can be used based on the value of flavors_available_zones.

The following is an example request for querying AZs with sufficient resources for flavor redis.ha.xu1.large.r2.2 in a region:

https://{dcs_endpoint}/v2/05041fffa40025702f6dc009cc6f8f33/flavors?spec_code=redis.ha.xu1.large.r2.2

Example response:

{
 "flavors": [
  {
   "dec": false,
   "spec_code": "redis.ha.xu1.large.r2.2",
   "cloud_service_type_code": "hws.service.type.dcs",
   "cloud_resource_type_code": "hws.resource.type.dcs3",
   "cache_mode": "ha",
   "engine": "redis",
   "engine_version": "4.0;5.0",
   "product_type": "generic",
   "cpu_type": "x86_64",
   "storage_type": "DRAM",
   "capacity": [
    "2"
   ],
   "billing_mode": [
    "Hourly",
    "Monthly",
    "Yearly"
   ],
   "tenant_ip_count": 2,
   "pricing_type": "normal",
   "is_dec": false,
   "attrs": [
    {
     "capacity": "2",
     "name": "max_memory",
     "value": "2"
    },
    {
     "capacity": "2",
     "name": "max_connections",
     "value": "50000"
    },
    {
     "capacity": "2",
     "name": "sharding_num",
     "value": "1"
    },
    {
     "capacity": "2",
     "name": "proxy_num",
     "value": "0"
    },
    {
     "capacity": "2",
     "name": "db_number",
     "value": "256"
    },
    {
     "capacity": "2",
     "name": "max_clients",
     "value": "10000"
    },
    {
     "capacity": "2",
     "name": "max_bandwidth",
     "value": "128"
    }
   ],
   "flavors_available_zones": [
    {
     "capacity": "2",
     "unit": "GB",
     "available_zones": [
      "a0865121f83b41cbafce65930a22a6e8",
      "15dcd3f789cb4fc088dbdece9c5eb547",
      "2dcb154ac2724a6d92e9bcc859657c1e",
      "effdcbc7d4d64a02aa1fa26b42f56533"
     ],
     "az_codes": [
      "xx-xx-xx1",
      "xx-xx-xx2",
      "xx-xx-xx3",
      "xx-xx-xx4"
     ]
    }
   ],
   "replica_count": 2,
   "inquery_spec_code": null
  }
 ]
}

flavors_available_zones indicates the AZs with sufficient resources for the flavor.

Querying Resource Quotas

To query the resource quotas of the current account, including the used quotas, call the API described in Querying the Tenant Quotas.

Example request:

GET https://{dcs_endpoint}/v2/05041fffa40025702f6dc009cc6f8f33/quota

Example response:

{
 "quotas": {
  "resources": [
   {
    "quota": 160,
    "used": 1,
    "type": "instance",
    "min": 0,
    "max": 2147483647,
    "unit": null
   },
   {
    "quota": 64000,
    "used": 0,
    "type": "ram",
    "min": 0,
    "max": 1048576,
    "unit": "GB"
   }
  ]
 }
}
  • When type is set to instance, max and min indicate the maximum and minimum instance quotas that can be applied for, respectively.
  • When type is set to ram, max and min indicate the maximum and minimum memory quotas that can be applied for, respectively.
  • quota is the maximum number of instances that can be created and the maximum allowed total memory.
  • used is the number of created instances and used memory.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback