Querying DB Instances
Function
This API is used to query DB instances based on specified conditions.
Constraints
This API supports the following DB instances:
- GaussDB(for Cassandra)
- GaussDB(for Mongo) cluster 3.4 and replica set 4.0
URI
- URI format
GET /v3/{project_id}/instances?id={id}&name={name}&mode={mode}&datastore_type={datastore_type}&vpc_id={vpc_id}&subnet_id={subnet_id}&offset={offset}&limit={limit}
- Parameter description
Table 1 Parameter description Name
Mandatory
Type
Description
project_id
Yes
String
Specifies the project ID of a tenant in a region.
id
No
String
Specifies the DB instance ID.
If you use asterisk (*) at the beginning of the id, fuzzy search results are returned. Otherwise, the exact results are returned.
name
No
String
Specifies the DB instance name.
If you use asterisk (*) at the beginning of the name, fuzzy search results are returned. Otherwise, the exact results are returned.
mode
No
String
Specifies the instance type.
Cluster indicates the GaussDB(for Cassandra) cluster instance.
Sharding indicates the GaussDB(for Mongo) cluster instance.
ReplicaSet indicates the GaussDB(for Mongo) replica set instance.
datastore_type
No
String
Specifies the database type.
If the value is cassandra, GaussDB(for Cassandra) instance is queried,
If the value is mongodb, the GaussDB(for Mongo) instance is queried.
If this parameter is not transferred, all GaussDB(for Cassandra) and GaussDB(for Mongo) instances are queried.
vpc_id
No
String
Specifies the VPC ID. To obtain this parameter value, use either of the following methods:
- Method 1: Log in to VPC console and view the VPC ID on the VPC details page.
- Method 2: Query the VPC ID through the VPC API. For details, see Querying VPCs.
subnet_id
No
String
Specifies the network ID of the subnet. To obtain this parameter value, use either of the following methods:
- Method 1: Log in to VPC console and click the target subnet on the Subnets page. You can view the subnet ID on the displayed page.
- Method 2: Query the subnet ID through the VPC API. For details, see Querying Subnets.
offset
No
Integer
Specifies the index position. The query starts from the next instance creation time indexed by this parameter under a specified project. If offset is set to N, the resource query starts from the N+1 piece of data
The value must be greater than or equal to 0. If this parameter is not transferred, offset is set to 0 by default, indicating that the query starts from the latest created DB instance.
limit
No
Integer
Specifies the maximum allowed number of DB instances.
The value ranges from 1 to 100. If this parameter is not transferred, the first 100 DB instances are queried by default.
Requests
- Request header Query all DB instances.
GET https://GaussDB_NoSQL_Endpoint/v3/0483b6b16e954cb88930a360d2c4e663/instances
Query DB instances based on specified conditions.
GET https://GaussDB_NoSQL_Endpoint/v3/0483b6b16e954cb88930a360d2c4e663/instances?offset=0&limit=10&id=ed7cc6166ec24360a5ed5c5c9c2ed726in06&name=hy&mode=Cluster&datastore_type=cassandra&vpc_id=19e5d45d-70fd-4a91-87e9-b27e71c9891f&subnet_id=bd51fb45-2dcb-4296-8783-8623bfe89bb7
Responses
- Parameter description
Table 2 Parameter description Name
Type
Description
instances
Array of objects
Indicates the DB instance information. For more information, see Table 3.
total_count
Integer
Indicates the total number of records.
Table 3 instances field data structure description Name
Type
Description
id
String
Indicates the DB instance ID.
name
String
Indicates the DB instance name.
status
String
Indicates the DB instance status.
Valid value:
- normal: indicates that the instance is running properly.
- abnormal: indicates that the instance is abnormal.
- creating: indicates that the instance is being created.
- data_disk_full: indicates that the instance disk is full.
- createfail: indicates that the instance failed to be created.
- enlargefail: indicates that nodes failed to be added to the instance.
port
Integer
Indicates the database port.
mode
String
Indicates the instance type, which is the same as the request parameter.
region
String
Indicates the region where the DB instance is deployed.
datastore
Object
Indicates the database information. For more information, see Table 4.
engine
String
Indicates the storage engine.
GaussDB(for Cassandra) and GaussDB(for Mongo) instances support the RocksDB storage engine. The value is rocksDB.
created
String
Indicates the DB instance creation time.
updated
String
Indicates the time when a DB instance is updated.
db_user_name
String
Indicates the default username. The value is rwuser.
vpc_id
String
Indicates the VPC ID.
subnet_id
String
Indicates the network ID of the subnet.
security_group_id
String
Indicates the security group ID.
backup_strategy
Object
Indicates the backup policy. For more information, see Table 5.
pay_mode
String
Indicates the billing mode. 0: indicates the pay-per-use billing mode.
maintenance_window
String
Indicates the maintenance time window.
groups
Array of objects
Indicates group information. For more information, see Table 6.
enterprise_project_id
String
Indicates the enterprise project ID.
If the value is 0, the resource belongs to the default enterprise project.
time_zone
String
Indicates the time zone.
actions
Array of strings
Indicates the operation that is executed on the DB instance.
Table 4 datastore field data structure description Name
Type
Description
type
String
Indicates the database type.
version
String
Indicates the database version.
Table 5 backup_strategy field data structure description Name
Type
Description
start_time
String
Indicates the backup time window. Automated backups will be triggered during the backup time window. The current time is the UTC time.
keep_days
Integer
Indicates the number of days to retain the generated backup files. The value ranges from 0 to 35.
Table 6 groups field data structure description Name
Type
Description
id
String
Indicates the group ID.
status
String
Indicates the group status.
volume
Object
Indicates the volume information. For more information, see Table 7.
nodes
Array of objects
Indicates node information. For more information, see Table 8.
Table 7 volume field data structure description Name
Type
Description
size
String
Indicates the storage space. Unit: GB
used
String
Indicates the disk usage. Unit: GB
Table 8 nodes field data structure description Name
Type
Description
id
String
Indicates the node ID.
name
String
Indicates the node name.
status
String
Indicates the node status.
role
String
Indicates the node role.
This parameter is valid only for replica set instances of the GaussDB(for Mongo) engine.
private_ip
String
Indicates the private IP address of a node. This parameter value exists after the ECS is created. Otherwise, the value is "".
public_ip
String
Indicates the bound EIP. This parameter is valid only for nodes bound with EIPs.
spec_code
String
Indicates the resource specifications code. For details about the instance specifications, see the value of the flavors.spec_code parameter in Querying All DB Instance Specifications.
availability_zone
String
Indicates the AZ.
support_reduce
Boolean
Indicates whether node scale-in is supported.
true: indicates that the node scale-in is supported.
false: indicates that the node scale-in is not supported.
The values of region and availability_zone in the response body are only examples. Set them based on the site requirements.
- Response example
{ "instances": [ { "id": "8436a91546294036b75931e879882200in06", "name": "nno-efa6", "status": "normal", "port": "8635", "mode": "Cluster", "region": "aaa", "datastore": { "type": "cassandra", "version": "3.11" }, "engine": " rocksDB ", "created": "2019-01-17T07:05:52", "updated": "2019-01-17T07:05:47", "db_user_name": "rwuser", "vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007b", "security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58", "backup_strategy": { "start_time": "16:00-17:00", "keep_days": 7 }, "pay_mode": "0", "maintenance_window": "02:00-06:00", "groups": [ { "id": "0b0ff12541794e1084f6827e424be2d6gr06", "status": "creating", "volume": { "size": "100", "used": "0.003" }, "nodes": [ { "id": "233eaac9c6f245c0bb9c2d21eea12d1bno06", "name": "nosql-efa6_priam_node_2", "status": "normal", "private_ip": "192.168.0.174", "spec_code": "geminidb.cassandra.xlarge.4", "availability_zone": "bbb" }, { "id": "d57d76d6320a4a7b86db82c317550c4ano02", "name": "nosql-efa6_priam_node_1", "status": "normal", "private_ip": "192.168.0.39", "spec_code": "geminidb.cassandra.xlarge.4", "availability_zone": "bbb" }, { "id": "f46b0a1cf4d9400e9fd7af17f8742d37no02", "name": "nosql-efa6_prima_node_3", "status": "normal", "private_ip": "192.168.0.176", "spec_code": "geminidb.cassandra.xlarge.4", "availability_zone": "bbb" } ] } ], "enterprise_project_id": "0", "time_zone": "", "actions": [ "CREATE" ] }, { "id": "1236a91546294036b75931e879882200in02", "name": "nosql-efa7", "status": "normal", "port": "8635", "mode": "ReplicaSet", "region": "aaa", "datastore": { "type": "mongodb", "version": "4.0" }, "engine": "rocksDB", "created": "2019-01-17T07:05:52", "updated": "2019-01-17T07:05:47", "db_user_name": "rwuser", "vpc_id": "674e9b42-cd8d-4d25-a2e6-5abcc565b961", "subnet_id": "f1df08c5-71d1-406a-aff0-de435a51007b", "security_group_id": "7aa51dbf-5b63-40db-9724-dad3c4828b58", "backup_strategy": { "start_time": "16:00-17:00", "keep_days": 7 }, "pay_mode": "0", "maintenance_window": "02:00-06:00", "groups": [ { "id": "0b0ff12541794e1084f6827e424be2d1gr02", "status": "normal", "volume": { "size": "100", "used": "0.003" }, "nodes": [ { "id": "233eaac9c6f245c0bb9c2d21eea12d1bno02", "name": "nosql-efa7_replica_node_2", "status": "normal", "role": "Primary", "private_ip": "192.168.0.174", "public_ip": "10.154.217.134", "spec_code": "geminidb.mongodb.xlarge.4", "availability_zone": "bbb" }, { "id": "d57d76d6320a4a7b86db82c317550c4ano02", "name": "nosql-efa7_replica_node_1", "status": "normal", "role": "Secondary", "private_ip": "192.168.0.39", "spec_code": "geminidb.mongodb.xlarge.4", "availability_zone": "bbb" }, { "id": "f46b0a1cf4d9400e9fd7af17f8742d37no02", "name": "nosql-efa7_replica_node_3", "status": "normal", "role": "Secondary", "private_ip": "192.168.0.176", "spec_code": "geminidb.mongodb.xlarge.4", "availability_zone": "bbb" } ] } ], "enterprise_project_id": "0", "time_zone": "", "actions": [ ] } ], "total_count": 2 }
Status Code
For more information, see Status Code.
Error Code
For more information, see Error Code.
Last Article: Deleting a DB Instance
Next Article: Scaling Up Storage Space
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.