alibabacloud-polardb-ai-assistant
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePolarDB Database AI Assistant
PolarDB数据库AI助手
This Skill focuses on Alibaba Cloud PolarDB MySQL/PostgreSQL database intelligent O&M, invoking the get-yao-chi-agent API through the aliyun CLI DAS plugin for diagnostics and analysis.
Architecture: → → → PolarDB Intelligent Diagnostics
Aliyun CLIDAS Plugin (Signature V3)get-yao-chi-agent API本Skill专注于阿里云PolarDB MySQL/PostgreSQL数据库智能运维,通过Aliyun CLI DAS插件调用get-yao-chi-agent API完成诊断分析。
架构: → → → PolarDB智能诊断
Aliyun CLIDAS Plugin (Signature V3)get-yao-chi-agent APISupported Capabilities
支持的能力
| Capability | Description |
|---|---|
| PolarDB Primary-Standby Switchover Analysis | Failover cause investigation, switchover log analysis, unexpected Failover diagnostics |
| PolarDB Kernel Parameter Change Assessment | Impact assessment before parameter modification, change risk analysis |
| PolarDB Kernel Parameter Explanation | Parameter meaning explanation, configuration suggestions, performance impact analysis |
| PolarDB Kernel Parameter Explanation (IMCI) | IMCI columnar engine related parameter explanation |
| PolarDB Kernel Version Proxy Diagnostics | Proxy layer troubleshooting, version compatibility diagnostics |
| PolarDB Kernel Version Instance Diagnostics | Instance layer version issue diagnostics, upgrade suggestions |
| Instance Query Filter | PolarDB instance search and filtering |
| Proxy Performance Monitoring | Proxy layer performance metrics analysis, connection routing diagnostics |
| Serverless Configuration | Serverless instance parameters and elastic scaling configuration |
| SQL Optimization Analysis | Slow SQL analysis, index suggestions, execution plan interpretation |
| Expiring Instance Query | Subscription instance expiration reminder |
| Backup Status Check | Backup completion, retention policy, recovery point in time |
| Storage Usage Diagnostics | Storage consumption analysis, growth trends, space optimization suggestions |
| Security Configuration Audit | Whitelist, SSL, security policy audit |
| Instance Status Check | Instance health status, running status verification |
| Log Diagnostics | Error log analysis, slow log troubleshooting |
| Auto-Increment ID Overflow Detection | Auto-increment ID exhaustion risk detection, primary key overflow warning |
| Connection and Session Analysis | Connection count monitoring, session issue troubleshooting, connection pool optimization |
| Cluster Performance Monitoring | QPS/TPS/connections/throughput and other core metrics analysis |
| High Availability and Disaster Recovery | HA configuration assessment, disaster recovery architecture diagnostics |
| 能力 | 描述 |
|---|---|
| PolarDB主备切换分析 | 故障切换原因排查、切换日志分析、异常故障切换诊断 |
| PolarDB内核参数变更评估 | 参数修改前影响评估、变更风险分析 |
| PolarDB内核参数说明 | 参数含义解释、配置建议、性能影响分析 |
| PolarDB内核参数说明(IMCI) | IMCI列存引擎相关参数解释 |
| PolarDB内核版本代理诊断 | 代理层问题排查、版本兼容性诊断 |
| PolarDB内核版本实例诊断 | 实例层版本问题诊断、升级建议 |
| 实例查询筛选 | PolarDB实例搜索与筛选 |
| 代理性能监控 | 代理层性能指标分析、连接路由诊断 |
| Serverless配置 | Serverless实例参数与弹性扩缩容配置 |
| SQL优化分析 | 慢SQL分析、索引建议、执行计划解读 |
| 到期实例查询 | 包年包月实例到期提醒 |
| 备份状态检查 | 备份完成情况、保留策略、可恢复时间点查询 |
| 存储使用诊断 | 存储消耗分析、增长趋势、空间优化建议 |
| 安全配置审计 | 白名单、SSL、安全策略审计 |
| 实例状态检查 | 实例健康状态、运行状态校验 |
| 日志诊断 | 错误日志分析、慢日志问题排查 |
| 自增ID溢出检测 | 自增ID耗尽风险检测、主键溢出告警 |
| 连接与会话分析 | 连接数监控、会话问题排查、连接池优化 |
| 集群性能监控 | QPS/TPS/连接数/吞吐量等核心指标分析 |
| 高可用与容灾 | HA配置评估、容灾架构诊断 |
Installation
安装
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
undefinedInstall aliyun CLI
安装aliyun CLI
curl -fsSL https://aliyuncli.alicdn.com/install.sh | bash
aliyun version # Verify >= 3.3.1
curl -fsSL https://aliyuncli.alicdn.com/install.sh | bash
aliyun version # 确认版本 >= 3.3.1
Enable automatic plugin installation
开启自动插件安装
aliyun configure set --auto-plugin-install true
aliyun configure set --auto-plugin-install true
Install DAS plugin (get-yao-chi-agent requires plugin for Signature V3 support)
安装DAS插件(get-yao-chi-agent需要插件支持Signature V3)
aliyun plugin install --names aliyun-cli-das
aliyun plugin install --names aliyun-cli-das
Install jq (for JSON response parsing)
安装jq(用于解析JSON响应)
macOS:
macOS:
brew install jq
brew install jq
Ubuntu/Debian:
Ubuntu/Debian:
sudo apt-get install jq
sudo apt-get install jq
undefinedundefinedParameter Confirmation
参数确认
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks, passwords, domain names, resource specifications, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
| Parameter | Required/Optional | Description | Default |
|---|---|---|---|
| Required | Natural language query content (including region, cluster info) | - |
| Optional | Session ID for multi-turn conversation | - |
| Optional | aliyun CLI profile name | default |
重要提示:参数确认 — 在执行任何命令或API调用前,所有用户可自定义参数(例如RegionId、实例名称、CIDR块、密码、域名、资源规格等)必须与用户确认,未经用户明确许可不得假设或使用默认值。
| 参数 | 必选/可选 | 描述 | 默认值 |
|---|---|---|---|
| 必选 | 自然语言查询内容(包含地域、集群信息) | - |
| 可选 | 多轮对话的会话ID | - |
| 可选 | aliyun CLI配置文件名 | default |
Authentication
认证
Credentials use existing aliyun CLI configuration, no additional AK/SK setup required:
bash
undefined凭证复用已有的aliyun CLI配置,无需额外配置AK/SK:
bash
undefinedRecommended: OAuth mode
推荐:OAuth模式
aliyun configure --mode OAuth
aliyun configure --mode OAuth
Or: AK mode
或:AK模式
aliyun configure set
--mode AK
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--region cn-hangzhou
--mode AK
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--region cn-hangzhou
aliyun configure set
--mode AK
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--region cn-hangzhou
--mode AK
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--region cn-hangzhou
Cross-account access: RamRoleArn mode
跨账号访问:RamRoleArn模式
aliyun configure set
--mode RamRoleArn
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--ram-role-arn acs:ram::<account-id>:role/<role-name>
--role-session-name yaochi-agent-session
--region cn-hangzhou
--mode RamRoleArn
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--ram-role-arn acs:ram::<account-id>:role/<role-name>
--role-session-name yaochi-agent-session
--region cn-hangzhou
undefinedaliyun configure set
--mode RamRoleArn
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--ram-role-arn acs:ram::<account-id>:role/<role-name>
--role-session-name yaochi-agent-session
--region cn-hangzhou
--mode RamRoleArn
--access-key-id <your-access-key-id>
--access-key-secret <your-access-key-secret>
--ram-role-arn acs:ram::<account-id>:role/<role-name>
--role-session-name yaochi-agent-session
--region cn-hangzhou
undefinedRAM Policy
RAM策略
See references/ram-policies.md
参考references/ram-policies.md
Core Workflow
核心工作流
All intelligent O&M operations are invoked through , which wraps (DAS plugin kebab-case command, supports Signature V3) with streaming response parsing.
scripts/call_yaochi_agent.shaliyun das get-yao-chi-agentbash
undefined所有智能运维操作都通过调用,该脚本封装了(DAS插件的短横线命名命令,支持Signature V3)并实现了流式响应解析。
scripts/call_yaochi_agent.shaliyun das get-yao-chi-agentbash
undefinedCluster management
集群管理
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "List PolarDB clusters in Hangzhou region"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Show detailed configuration of cluster pc-xxx"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "List PolarDB clusters in Hangzhou region"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Show detailed configuration of cluster pc-xxx"
Performance diagnostics
性能诊断
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Analyze cluster pc-xxx performance in the last hour"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Show slow SQL of cluster pc-xxx"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Analyze cluster pc-xxx performance in the last hour"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Show slow SQL of cluster pc-xxx"
Parameter tuning
参数调优
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "How to tune innodb_buffer_pool_size for cluster pc-xxx"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Explain loose_polar_log_bin parameter"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "How to tune innodb_buffer_pool_size for cluster pc-xxx"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Explain loose_polar_log_bin parameter"
Primary-standby switchover diagnostics
主备切换诊断
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Analyze recent primary-standby switchover cause for cluster pc-xxx"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Analyze recent primary-standby switchover cause for cluster pc-xxx"
Connection and session
连接与会话
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "How to troubleshoot high connection count in cluster pc-xxx"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "How to troubleshoot high connection count in cluster pc-xxx"
Backup recovery
备份恢复
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Show backup status of cluster pc-xxx"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Show backup status of cluster pc-xxx"
Multi-turn conversation (use session ID from previous response)
多轮对话(使用上一次响应返回的会话ID)
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Continue analysis" --session-id "<session-id>"
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "Continue analysis" --session-id "<session-id>"
Specify profile
指定配置文件
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "List clusters" --profile myprofile
bash $SKILL_DIR/scripts/call_yaochi_agent.sh "List clusters" --profile myprofile
Read from stdin
从标准输入读取内容
echo "List clusters" | bash $SKILL_DIR/scripts/call_yaochi_agent.sh -
undefinedecho "List clusters" | bash $SKILL_DIR/scripts/call_yaochi_agent.sh -
undefinedExample Questions
示例问题
| Scenario | Example Question |
|---|---|
| Cluster Management | List nodes of cluster pc-xxx |
| Performance Diagnostics | How to troubleshoot high CPU usage in cluster pc-xxx |
| Slow SQL Analysis | Show slow SQL in cluster pc-xxx in the last hour |
| Parameter Tuning | What does loose_polar_log_bin parameter mean |
| IMCI Parameters | How to configure IMCI related parameters for cluster pc-xxx |
| Primary-Standby | How to handle high primary-standby delay in cluster pc-xxx |
| Backup Recovery | When was the latest backup of cluster pc-xxx |
| Storage Optimization | What to do if storage usage of cluster pc-xxx grows too fast |
| Connection Troubleshooting | Cluster pc-xxx connections are full |
| Security Audit | Check security configuration of cluster pc-xxx |
| 场景 | 示例问题 |
|---|---|
| 集群管理 | 列出pc-xxx集群的节点 |
| 性能诊断 | 如何排查pc-xxx集群CPU使用率高的问题 |
| 慢SQL分析 | 展示pc-xxx集群过去1小时的慢SQL |
| 参数调优 | loose_polar_log_bin参数的含义是什么 |
| IMCI参数 | 如何为pc-xxx集群配置IMCI相关参数 |
| 主备相关 | 如何处理pc-xxx集群主备延迟高的问题 |
| 备份恢复 | pc-xxx集群最近一次备份是什么时候 |
| 存储优化 | pc-xxx集群存储用量增长过快怎么办 |
| 连接问题排查 | pc-xxx集群连接数已满 |
| 安全审计 | 检查pc-xxx集群的安全配置 |
Success Verification
成功验证
See references/verification-method.md
参考references/verification-method.md
Cleanup
清理
This Skill focuses on query and diagnostics capabilities, does not create any resources, no cleanup required.
The following operations are NOT within the scope of this Skill:
- Create/delete PolarDB clusters
- Change instance specifications
- Purchase/renew instances
本Skill仅提供查询和诊断能力,不会创建任何资源,无需清理操作。
以下操作不在本Skill支持范围内:
- 创建/删除PolarDB集群
- 变更实例规格
- 购买/续费实例
API and Command Tables
API与命令表
See references/related-apis.md
参考references/related-apis.md
Best Practices
最佳实践
- Cluster ID Format: PolarDB cluster IDs typically start with , include the full cluster ID in queries
pc- - Region Specification: Explicitly specify region in natural language queries (e.g., "Hangzhou region", "Beijing region") to improve query accuracy
- Multi-turn Conversation: Use for complex diagnostic scenarios to maintain context continuity
--session-id - Concurrency Limit: Maximum 2 concurrent sessions per account, avoid initiating multiple parallel calls
- High-risk Operations: For operations involving parameter changes, primary-standby switchover, always remind users to verify in test environment first
- Throttling Handling: If encountering error, wait for previous query to complete and retry
Throttling.UserConcurrentLimit - Credential Security: Use to manage credentials, never hardcode AK/SK in scripts
aliyun configure
- 集群ID格式:PolarDB集群ID通常以开头,查询时请传入完整的集群ID
pc- - 指定地域:自然语言查询中请明确说明地域(例如“杭州地域”、“北京地域”)以提升查询准确率
- 多轮对话:复杂诊断场景下使用保持上下文连续性
--session-id - 并发限制:每个账号最多同时存在2个会话,避免发起多个并行调用
- 高风险操作:涉及参数变更、主备切换的操作,请始终提醒用户先在测试环境验证
- 限流处理:如果遇到错误,请等待上一次查询完成后重试
Throttling.UserConcurrentLimit - 凭证安全:使用管理凭证,禁止在脚本中硬编码AK/SK
aliyun configure
Reference Links
参考链接
| Reference | Description |
|---|---|
| references/cli-installation-guide.md | Aliyun CLI installation and configuration guide |
| references/related-apis.md | Related API and CLI command list |
| references/ram-policies.md | RAM permission policy list |
| references/verification-method.md | Success verification methods |
| references/acceptance-criteria.md | Acceptance criteria |
| 参考文档 | 描述 |
|---|---|
| references/cli-installation-guide.md | Aliyun CLI安装与配置指南 |
| references/related-apis.md | 相关API与CLI命令列表 |
| references/ram-policies.md | RAM权限策略列表 |
| references/verification-method.md | 成功验证方法 |
| references/acceptance-criteria.md | 验收标准 |