An instance is a logical entity used in Tablestore to manage tables. Each instance is equivalent to a database. This topic describes how to use the Tablestore CLI to manage Tablestore instances.
Prerequisites
Tablestore is activated. For more information, see Activate Tablestore.
Create an instance
Create a high-performance instance in the region in which you want to use Tablestore.
The instance name must be unique within the region. If an error prompts that the instance name you specified is the same as an existing instance, specify a new instance name.
You can create only high-performance instances if you use the Tablestore CLI.
Syntax
create_instance -d description -n instanceName -r regionId
The following table describes the configuration items:
Parameter | Required | Example | Description |
-n | Yes | myinstance | The name of the instance. For more information, see Instances. |
-r | Yes | cn-hangzhou | The ID of the region. For more information, see Regions. |
-d | No | "First instance created by CLI." | The description of the instance. |
Example
The following sample code provides an example on how to create a high-performance instance named myinstance in the China (Hangzhou) region:
create_instance -d "First instance created by CLI." -n myinstance -r cn-hangzhou
Configure the instance
You can manage resources in your instance only after you configure it.
You must configure the instance when you configure access information if the instance information is not yet configured or if you want to access another instance.
You must specify an instance to access by configuring its service endpoint. Endpoints vary based on the type of network that you are using.
Syntax
config --endpoint endpoint --instance instanceName
The following table describes the configuration items:
Parameter | Required | Example | Description |
--endpoint | Yes | http://myinstance.cn-hangzhou.ots.aliyuncs.com | The endpoint of the instance, which supports two network types: Internet and virtual private cloud (VPC). Specify the endpoint of the instance based on your network type. The endpoint format must comply with the following rules:
|
--instance | Yes | myinstance | The name of the instance. |
Example
The following sample code shows how to configure the myinstance instance in the China (Hangzhou) region that is to be accessed over a public endpoint.
config --endpoint http://myinstance.cn-hangzhou.ots.aliyuncs.com --instance myinstance
Sample output:
{
"Endpoint": "http://myinstance.cn-hangzhou.ots.aliyuncs.com",
"AccessKeyId": "NTS**********************",
"AccessKeySecret": "7NR2****************************************",
"AccessKeySecretToken": "",
"Instance": "myinstance"
}
The following table describes the parameters:
Parameter | Required | Example | Description |
Endpoint | No | https://myinstance.cn-hangzhou.ots.aliyuncs.com | The endpoint of the instance. For more information, see Endpoints. |
Instance | No | myinstance | The name of the instance. |
AccessKeyId | Yes | NTS********************** | The AccessKey ID and AccessKey secret of your Alibaba Cloud account or RAM user. Note If you use the temporary access credential obtained from Security Token Service (STS) to access Tablestore, the returned AccessKeyId and AccessKeySecret are the AccessKey ID and AccessKey secret returned by STS, respectively. |
AccessKeySecret | Yes | 7NR2**************************************** | |
AccessKeySecretToken | No | STS.6MC2**************************************** | The temporary access token. This parameter is returned if you access Tablestore by using the temporary access credential obtained from STS. |
View instance information
You can query information about an instance, such as the instance name, creation time, and the ID of the account to which the instance belongs.
Syntax
describe_instance -r regionId -n instanceName
The following table describes the configuration items:
Parameter | Required | Example | Description |
-n | Yes | myinstance | The name of the instance. For more information, see Instances. |
-r | Yes | cn-hangzhou | The ID of the region. For more information, see Regions. |
Example
The following sample code shows how to query the information of the myinstance instance in the China (Hangzhou) region:
describe_instance -r cn-hangzhou -n myinstance
Sample output:
{
"ClusterType": "ssd",
"CreateTime": "2024-07-18 09:15:10",
"Description": "First instance created by CLI.",
"InstanceName": "myinstance",
"Network": "NORMAL",
"Quota": {
"EntityQuota": 64
},
"ReadCapacity": 5000,
"Status": 1,
"TagInfos": {},
"UserId": "1379************",
"WriteCapacity": 5000
}
Query instances
You can query all instances in a specified region.
Syntax
list_instance -r regionId
The following table describes the configuration items:
Parameter | Required | Example | Description |
-r | Yes | cn-hangzhou | The ID of the region. |
Example
The following sample code shows how to obtain a list of all instances in the China (Hangzhou) region:
list_instance -r cn-hangzhou
Sample output:
If no instance is created in the specified region, the returned result is empty.
[
"myinstance"
]
References
After you create an instance and configure the access information of the instance, you can use Tablestore features based on the data storage model required by your business.
Data model | Use process |
Wide Column model |
If you want to migrate data or use compute engines to process data, use Tunnel Service. For more information, see Tunnel Service. |
TimeSeries model |
|