alibabacloud-elasticsearch-instance-manage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseElasticsearch Instance Management
Elasticsearch实例管理
Manage Alibaba Cloud Elasticsearch instances: create, describe, list, restart, and query node information.
管理阿里云Elasticsearch实例:创建、查询详情、列举实例、重启实例以及查询节点信息。
Architecture
架构
Alibaba Cloud Elasticsearch Instance Management
├── createInstance (Create Instance)
├── DescribeInstance (Query Instance Details)
├── ListInstance (List Instances)
├── ListAllNode (Query Cluster Node Info)
└── RestartInstance (Restart Instance)Alibaba Cloud Elasticsearch Instance Management
├── createInstance (创建实例)
├── DescribeInstance (查询实例详情)
├── ListInstance (列举实例)
├── ListAllNode (查询集群节点信息)
└── RestartInstance (重启实例)Prerequisites
前置要求
Pre-check: Aliyun CLI >= 3.3.1 required Runto verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] runaliyun versionto enable automatic plugin installation.aliyun configure set --auto-plugin-install true
bash
undefined前置检查:要求Aliyun CLI版本 >= 3.3.1 运行确认版本不低于3.3.1。如果未安装或版本过低,请参考references/cli-installation-guide.md的安装指引。 然后[必须]运行aliyun version开启自动插件安装功能。aliyun configure set --auto-plugin-install true
bash
undefinedVerify CLI version
校验CLI版本
aliyun version
aliyun version
Enable auto plugin installation
开启自动插件安装
aliyun configure set --auto-plugin-install true
---aliyun configure set --auto-plugin-install true
---Authentication
身份认证
Pre-check: Alibaba Cloud Credentials RequiredSecurity Rules (MUST FOLLOW):
- NEVER read, echo, or print AK/SK values
- NEVER ask the user to input AK/SK directly in the conversation
- NEVER use
with literal credential valuesaliyun configure set- NEVER accept AK/SK provided directly by users in the conversation
- ONLY read credentials from environment variables or pre-configured CLI profiles
⚠️ CRITICAL: Handling User-Provided CredentialsIf a user attempts to provide AK/SK directly (e.g., "My AK is xxx, SK is yyy"):
- STOP immediately - Do NOT execute any command
- Reject the request politely with the following message:
For your account security, please do not provide Alibaba Cloud AccessKey ID and AccessKey Secret directly in the conversation. Please use the following secure methods to configure credentials: Method 1: Interactive configuration via aliyun configure (Recommended) aliyun configure # Enter AK/SK as prompted, credentials will be securely stored in local config file Method 2: Configure via environment variables export ALIBABA_CLOUD_ACCESS_KEY_ID=<your-access-key-id> export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<your-access-key-secret> After configuration, please retry your request.- Do NOT proceed with any Alibaba Cloud operations until credentials are properly configured
Check CLI configuration:bashaliyun configure listCheck the output for a valid profile (AK, STS, or OAuth identity).If no valid credentials exist, STOP here.
前置检查:需要阿里云凭证安全规则(必须遵守):
- 绝对不要读取、回显或打印AK/SK的值
- 绝对不要要求用户在对话中直接输入AK/SK
- 绝对不要使用明文凭证值执行
命令aliyun configure set- 绝对不要接受用户在对话中直接提供的AK/SK
- 仅从环境变量或预先配置的CLI配置文件中读取凭证
⚠️ 重要提示:处理用户提供的凭证如果用户尝试直接提供AK/SK(例如:"我的AK是xxx,SK是yyy"):
- 立即停止操作 - 不要执行任何命令
- 礼貌拒绝请求,返回以下信息:
为了您的账户安全,请不要在对话中直接提供阿里云AccessKey ID和AccessKey Secret。 请使用以下安全方式配置凭证: 方式1:通过aliyun configure交互式配置(推荐) aliyun configure # 按照提示输入AK/SK,凭证将安全存储在本地配置文件中 方式2:通过环境变量配置 export ALIBABA_CLOUD_ACCESS_KEY_ID=<your-access-key-id> export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<your-access-key-secret> 配置完成后,请重试您的请求。- 不要继续执行任何阿里云操作,直到凭证正确配置
检查CLI配置:bashaliyun configure list检查输出中是否存在有效的配置文件(AK、STS或OAuth身份)。如果没有有效凭证,请停止操作。
RAM Policy
RAM权限策略
Ensure the RAM user has the required permissions. See references/ram-policies.md for detailed policy configurations.
Minimum Required Permissions:
elasticsearch:CreateInstanceelasticsearch:DescribeInstanceelasticsearch:ListInstanceelasticsearch:ListAllNodeelasticsearch:RestartInstance
确保RAM用户拥有所需权限。参考references/ram-policies.md查看详细的权限配置。
最低所需权限:
elasticsearch:CreateInstanceelasticsearch:DescribeInstanceelasticsearch:ListInstanceelasticsearch:ListAllNodeelasticsearch:RestartInstance
Core Workflow
核心工作流程
Note: Elasticsearch APIs use ROA (RESTful) style. You can useto specify the HTTP request body as a JSON string. See examples in each task below.--body
Idempotency: For write operations (create, restart, delete, etc.), you MUST use theparameter to ensure idempotency.--client-token
- Use a UUID format unique identifier as clientToken
- When a request times out or fails, you can safely retry with the same clientToken. When retrying after timeout, it is recommended to wait 10 seconds before retrying
- Duplicate requests with the same clientToken will not execute the operation repeatedly
- Generation method: Prefer using uuidgen or PowerShell GUID; if the environment doesn't support it, generate a UUID format string directly; if strict randomness is not required, use idem-timestamp-semantic-identifier as a fallback. Do not interrupt the process due to unavailable commands.
注意: Elasticsearch API使用ROA (RESTful) 风格。您可以使用参数指定JSON格式的HTTP请求体,参考下方每个任务的示例。--body
幂等性: 对于写操作(创建、重启、删除等),您必须使用参数保证幂等性。--client-token
- 使用UUID格式的唯一标识作为clientToken
- 当请求超时或失败时,您可以使用相同的clientToken安全重试。超时后重试建议等待10秒再执行
- 使用相同clientToken的重复请求不会重复执行操作
- 生成方式:优先使用uuidgen或PowerShell GUID;如果环境不支持,直接生成UUID格式字符串;如果不需要严格随机性,可以使用idem-timestamp-semantic-identifier作为备用。不要因为命令不可用中断流程。
Task 1: Create Elasticsearch Instance
任务1:创建Elasticsearch实例
node-specifications-by-region.md Different roles in different regions support different specifications when creating instances, refer to this document.
⚠️ CRITICAL: Required Parameters and Region ValidationWhen creating an ES instance, parameters such as,--region,esAdminPassword,vpcId,vswitchId,vsAreaMUST be explicitly provided by the user.paymentTypeImportant Notes:
- The
parameter MUST NOT be guessed or use default values--region- If the user does not provide a region or provides an invalid region, you MUST clearly prompt the user to provide a valid region
For detailed validation rules, refer to related-apis.md - createInstance Required Parameters and Region Validation
Method 2: Using --body to specify HTTP request body (RESTful style)
bash
undefinednode-specifications-by-region.md 创建实例时不同地域的不同角色支持不同规格,参考该文档。
⚠️ 重要提示:必填参数和地域校验创建ES实例时,、--region、esAdminPassword、vpcId、vswitchId、vsArea等参数必须由用户明确提供。paymentType重要注意事项:
参数绝对不能猜测或使用默认值--region- 如果用户未提供地域或提供的地域无效,您必须明确提示用户提供有效的地域
详细的校验规则参考related-apis.md - createInstance必填参数和地域校验
方式2:使用--body指定HTTP请求体(RESTful风格)
bash
undefinedGenerate idempotency token first
首先生成幂等性token
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance
--region <RegionId>
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "<Password>", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "<VpcId>", "vswitchId": "<VswitchId>", "vsArea": "<ZoneId>", "type": "vpc" }, "paymentType": "postpaid", "description": "<InstanceName>" }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region <RegionId>
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "<Password>", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "<VpcId>", "vswitchId": "<VswitchId>", "vsArea": "<ZoneId>", "type": "vpc" }, "paymentType": "postpaid", "description": "<InstanceName>" }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**Example: Create Single Availability Zone Instance**
```bashCLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance
--region <RegionId>
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "<Password>", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "<VpcId>", "vswitchId": "<VswitchId>", "vsArea": "<ZoneId>", "type": "vpc" }, "paymentType": "postpaid", "description": "<InstanceName>" }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region <RegionId>
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "<Password>", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "<VpcId>", "vswitchId": "<VswitchId>", "vsArea": "<ZoneId>", "type": "vpc" }, "paymentType": "postpaid", "description": "<InstanceName>" }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**示例:创建单可用区实例**
```bashGenerate idempotency token (use the same token when retrying after timeout)
生成幂等性token(超时重试时使用相同token)
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**Example: Create Multi-Availability Zone Instance**
1. For multi-AZ instances, networkConfig.vswitchId only supports the primary availability zone vSwitch, and networkConfig.vsArea only supports the primary availability zone name. Nodes will be automatically distributed to different availability zones. Do not specify availability zones and vSwitches through zoneInfos when creating, let the cloud provider allocate automatically.
2. Specify the number of availability zones through zoneCount. For multi-AZ instances, you must create master nodes.
```bashCLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**示例:创建多可用区实例**
1. 对于多可用区实例,networkConfig.vswitchId仅支持主可用区vSwitch,networkConfig.vsArea仅支持主可用区名称。节点将自动分配到不同可用区。创建时不要通过zoneInfos指定可用区和vSwitch,由云服务商自动分配。
2. 通过zoneCount指定可用区数量。多可用区实例必须创建主节点。
```bashGenerate idempotency token
生成幂等性token
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "zoneCount": "2", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 }, "masterConfiguration": { "amount": 3, "disk": 20, "diskType": "cloud_essd", "spec": "elasticsearch.sn2ne.xlarge" } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "zoneCount": "2", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 }, "masterConfiguration": { "amount": 3, "disk": 20, "diskType": "cloud_essd", "spec": "elasticsearch.sn2ne.xlarge" } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**Error Handling**
1. When an error occurs indicating that order parameters do not meet validation conditions, it may be due to incorrect data node specifications. You should prompt the user to use the correct specifications and not guess on your own. Refer to the specifications document [node-specifications-by-region.md](references/node-specifications-by-region.md)CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch create-instance
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "zoneCount": "2", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 }, "masterConfiguration": { "amount": 3, "disk": 20, "diskType": "cloud_essd", "spec": "elasticsearch.sn2ne.xlarge" } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--client-token $CLIENT_TOKEN
--body '{ "esAdminPassword": "YourPassword123!", "esVersion": "7.10_with_X-Pack", "nodeAmount": 2, "nodeSpec": { "disk": 20, "diskType": "cloud_ssd", "spec": "elasticsearch.sn2ne.large.new" }, "networkConfig": { "vpcId": "vpc-bp1xxx", "vswitchId": "vsw-bp1xxx", "vsArea": "cn-hangzhou-i", "type": "vpc" }, "paymentType": "postpaid", "description": "my-es-instance", "zoneCount": "2", "kibanaConfiguration": { "spec": "elasticsearch.sn1ne.large", "amount": 1, "disk": 0 }, "masterConfiguration": { "amount": 3, "disk": 20, "diskType": "cloud_essd", "spec": "elasticsearch.sn2ne.xlarge" } }'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**错误处理**
1. 当出现订单参数不符合校验条件的错误时,可能是数据节点规格不正确。您应该提示用户使用正确的规格,不要自行猜测。参考规格文档[node-specifications-by-region.md](references/node-specifications-by-region.md)Task 2: Describe Instance Details
任务2:查询实例详情
⚠️ Important: Required Parameters Must Be Provided by User When querying instance details,and--regionmust be explicitly provided by the user. Do not guess the region. For detailed instructions, refer to related-apis.md - DescribeInstance Required Parameters--instance-id
bash
aliyun elasticsearch describe-instance \
--region <RegionId> \
--instance-id <InstanceId> \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-SkillsExample:
bash
aliyun elasticsearch describe-instance \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills⚠️ 重要提示:必填参数必须由用户提供 查询实例详情时,和--region必须由用户明确提供。不要猜测地域。 详细说明参考related-apis.md - DescribeInstance必填参数--instance-id
bash
aliyun elasticsearch describe-instance \
--region <RegionId> \
--instance-id <InstanceId> \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills示例:
bash
aliyun elasticsearch describe-instance \
--region cn-hangzhou \
--instance-id es-cn-xxx**** \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-SkillsTask 3: List Instances
任务3:列举实例
⚠️ Important: Required Parameters and Parameter Validation
- The
parameter must be explicitly provided by the user. Do not guess or use default values.--region- The
parameter only supports valid values:--status,activating,active,inactive(case-sensitive)invalid- For detailed instructions, refer to related-apis.md - ListInstance Required Parameters and Parameter Validation
bash
aliyun elasticsearch list-instance \
--region <RegionId> \
--page 1 \
--size 10 \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-SkillsExample with filters:
bash
undefined⚠️ 重要提示:必填参数和参数校验
参数必须由用户明确提供。不要猜测或使用默认值。--region 参数仅支持有效值:--status、activating、active、inactive(区分大小写)invalid- 详细说明参考related-apis.md - ListInstance必填参数和参数校验
bash
aliyun elasticsearch list-instance \
--region <RegionId> \
--page 1 \
--size 10 \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills带过滤条件的示例:
bash
undefinedList all instances
列举所有实例
aliyun elasticsearch list-instance
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
aliyun elasticsearch list-instance
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
Filter by status
按状态过滤
aliyun elasticsearch list-instance
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
aliyun elasticsearch list-instance
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
Filter by name (fuzzy match)
按名称过滤(模糊匹配)
aliyun elasticsearch list-instance
--region cn-hangzhou
--description "my-es"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--description "my-es"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
undefinedaliyun elasticsearch list-instance
--region cn-hangzhou
--description "my-es"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--description "my-es"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
undefinedTask 4: Restart Instance
任务4:重启实例
⚠️ CRITICAL: Pre-restart Check RequirementsBefore executing a restart operation, you must first query the instance status and confirm it is: Pre-check Rules:active
- Only when the instance status is
can you execute the restart operationactive- If the instance status is abnormal (such as
,activating,inactive, etc.), restart operation is prohibitedinvalid- If the instance status is abnormal, you should inform the user that the current status is not suitable for restart and recommend waiting for the instance to recover or contacting Alibaba Cloud technical support
Using --body to specify HTTP request body (RESTful style)
bash
undefined⚠️ 重要提示:重启前检查要求执行重启操作前,您必须先查询实例状态,确认状态为: 前置检查规则:active
- 仅当实例状态为
时才能执行重启操作active- 如果实例状态异常(例如
、activating、inactive等),禁止执行重启操作invalid- 如果实例状态异常,您应该告知用户当前状态不适合重启,建议等待实例恢复或联系阿里云技术支持
使用--body指定HTTP请求体(RESTful风格)
bash
undefinedGenerate idempotency token
生成幂等性token
CLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch restart-instance
--region <RegionId>
--instance-id <InstanceId>
--client-token $CLIENT_TOKEN
--body '<JSON_BODY>'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region <RegionId>
--instance-id <InstanceId>
--client-token $CLIENT_TOKEN
--body '<JSON_BODY>'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**Example (using --body):**
```bashCLIENT_TOKEN=$(uuidgen)
aliyun elasticsearch restart-instance
--region <RegionId>
--instance-id <InstanceId>
--client-token $CLIENT_TOKEN
--body '<JSON_BODY>'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region <RegionId>
--instance-id <InstanceId>
--client-token $CLIENT_TOKEN
--body '<JSON_BODY>'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**示例(使用--body):**
```bashGenerate idempotency token
生成幂等性token
CLIENT_TOKEN=$(uuidgen)
CLIENT_TOKEN=$(uuidgen)
Normal restart
正常重启
aliyun elasticsearch restart-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance"}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance"}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
aliyun elasticsearch restart-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance"}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance"}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
Force restart
强制重启
aliyun elasticsearch restart-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance","force":true}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance","force":true}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
aliyun elasticsearch restart-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance","force":true}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"instance","force":true}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
Restart specific nodes
重启指定节点
aliyun elasticsearch restart-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"nodeIp","nodes":["10.0.XX.XX","10.0.XX.XX"]}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"nodeIp","nodes":["10.0.XX.XX","10.0.XX.XX"]}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
undefinedaliyun elasticsearch restart-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"nodeIp","nodes":["10.0.XX.XX","10.0.XX.XX"]}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--client-token $CLIENT_TOKEN
--body '{"restartType":"nodeIp","nodes":["10.0.XX.XX","10.0.XX.XX"]}'
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
undefinedTask 5: List All Nodes (Query Cluster Node Information)
任务5:列举所有节点(查询集群节点信息)
bash
aliyun elasticsearch list-all-node \
--region <RegionId> \
--instance-id <InstanceId> \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-SkillsParameters:
| Parameter | Required | Description |
|---|---|---|
| Yes | Instance ID |
| No | Whether to return node monitoring information, default true |
Example:
bash
undefinedbash
aliyun elasticsearch list-all-node \
--region <RegionId> \
--instance-id <InstanceId> \
--connect-timeout 3 \
--read-timeout 10 \
--user-agent AlibabaCloud-Agent-Skills参数:
| 参数 | 是否必填 | 说明 |
|---|---|---|
| 是 | 实例ID |
| 否 | 是否返回节点监控信息,默认true |
示例:
bash
undefinedList all nodes with monitoring info
列举所有节点并返回监控信息
aliyun elasticsearch list-all-node
--region cn-hangzhou
--instance-id es-cn-xxx****
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
aliyun elasticsearch list-all-node
--region cn-hangzhou
--instance-id es-cn-xxx****
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
Query specific fields
查询指定字段
aliyun elasticsearch list-all-node
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result[].{Host:host,Type:nodeType,Health:health,CPU:cpuPercent,Heap:heapPercent,Disk:diskUsedPercent}"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result[].{Host:host,Type:nodeType,Health:health,CPU:cpuPercent,Heap:heapPercent,Disk:diskUsedPercent}"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**Response Fields:**
| Field | Description |
|-------|-------------|
| `host` | Node IP address |
| `nodeType` | Node type: MASTER/WORKER/WORKER_WARM/COORDINATING/KIBANA |
| `health` | Node health status: GREEN/YELLOW/RED/GRAY |
| `cpuPercent` | CPU usage rate |
| `heapPercent` | JVM memory usage rate |
| `diskUsedPercent` | Disk usage rate |
| `loadOneM` | One minute load |
| `zoneId` | Availability zone where the node is located |
| `port` | Node access port |
---aliyun elasticsearch list-all-node
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result[].{Host:host,Type:nodeType,Health:health,CPU:cpuPercent,Heap:heapPercent,Disk:diskUsedPercent}"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result[].{Host:host,Type:nodeType,Health:health,CPU:cpuPercent,Heap:heapPercent,Disk:diskUsedPercent}"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
**响应字段:**
| 字段 | 说明 |
|-------|-------------|
| `host` | 节点IP地址 |
| `nodeType` | 节点类型:MASTER/WORKER/WORKER_WARM/COORDINATING/KIBANA |
| `health` | 节点健康状态:GREEN/YELLOW/RED/GRAY |
| `cpuPercent` | CPU使用率 |
| `heapPercent` | JVM内存使用率 |
| `diskUsedPercent` | 磁盘使用率 |
| `loadOneM` | 一分钟负载 |
| `zoneId` | 节点所在可用区 |
| `port` | 节点访问端口 |
---Success Verification
成功验证
See references/verification-method.md for detailed verification steps.
Quick Verification:
bash
undefined参考references/verification-method.md查看详细验证步骤。
快速验证:
bash
undefinedCheck instance status
检查实例状态
aliyun elasticsearch describe-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result.status"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result.status"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
Expected status: `active`
---aliyun elasticsearch describe-instance
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result.status"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
--region cn-hangzhou
--instance-id es-cn-xxx****
--cli-query "Result.status"
--connect-timeout 3
--read-timeout 10
--user-agent AlibabaCloud-Agent-Skills
预期状态:`active`
---Best Practices
最佳实践
- Always confirm parameters before executing create commands
- Use to filter JSON output for specific fields
--cli-query - Monitor instance status after create/restart operations
- Set meaningful instance names using for easy identification
--description - Use appropriate node specifications based on your workload requirements
- Configure Kibana for visualization and management
- Enable master nodes for production environments with 3+ data nodes
- Use idempotency tokens () for all write operations to enable safe retries on timeout
--client-token
- 执行创建命令前始终确认参数
- **使用**过滤JSON输出,获取指定字段
--cli-query - 创建/重启操作后监控实例状态
- 使用设置有意义的实例名称,方便识别
--description - 根据工作负载需求使用合适的节点规格
- 配置Kibana用于可视化和管理
- 3个及以上数据节点的生产环境开启主节点
- 所有写操作使用幂等性token(),支持超时后安全重试
--client-token
Idempotency Best Practices
幂等性最佳实践
For write operations (create, restart, delete), be sure to follow these idempotency best practices:
- Generate unique Token before each operation: Use to generate UUID
uuidgen - Reuse Token when retrying after timeout: If the request times out, retry with the same clientToken. When the user requests a retry, use the same clientToken
- Use different Tokens for different operations: Each independent operation requires a new clientToken, but if the user requests a retry, use the same clientToken
- Token validity: clientToken is typically valid for 24 hours
bash
undefined对于写操作(创建、重启、删除),请务必遵守以下幂等性最佳实践:
- 每次操作前生成唯一Token:使用生成UUID
uuidgen - 超时重试时复用Token:如果请求超时,使用相同的clientToken重试。用户请求重试时,使用相同的clientToken
- 不同操作使用不同Token:每个独立操作需要新的clientToken,但用户请求重试时使用相同的clientToken
- Token有效期:clientToken通常有效期为24小时
bash
undefinedExample: Safe retry pattern
示例:安全重试模式
CLIENT_TOKEN=$(uuidgen)
echo "Using clientToken: $CLIENT_TOKEN"
CLIENT_TOKEN=$(uuidgen)
echo "Using clientToken: $CLIENT_TOKEN"
First attempt
首次尝试
aliyun elasticsearch create-instance --client-token $CLIENT_TOKEN ...
aliyun elasticsearch create-instance --client-token $CLIENT_TOKEN ...
If timeout, retry with the same Token
如果超时,使用相同Token重试
aliyun elasticsearch create-instance --client-token $CLIENT_TOKEN ...
---aliyun elasticsearch create-instance --client-token $CLIENT_TOKEN ...
---Reference Links
参考链接
| Reference | Description |
|---|---|
| related-apis.md | API and CLI command details |
| ram-policies.md | RAM permission policies |
| verification-method.md | Verification steps |
| acceptance-criteria.md | Correct/incorrect patterns |
| cli-installation-guide.md | CLI installation guide |
| node-specifications-by-region.md | Node specifications by region and role |
| 参考文档 | 说明 |
|---|---|
| related-apis.md | API和CLI命令详情 |
| ram-policies.md | RAM权限策略 |
| verification-method.md | 验证步骤 |
| acceptance-criteria.md | 正确/错误模式 |
| cli-installation-guide.md | CLI安装指引 |
| node-specifications-by-region.md | 不同地域和角色的节点规格 |