alibabacloud-polardb-ai-assistant

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PolarDB 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:
Aliyun CLI
DAS Plugin (Signature V3)
get-yao-chi-agent API
→ PolarDB Intelligent Diagnostics
本Skill专注于阿里云PolarDB MySQL/PostgreSQL数据库智能运维,通过Aliyun CLI DAS插件调用get-yao-chi-agent API完成诊断分析。
架构
Aliyun CLI
DAS Plugin (Signature V3)
get-yao-chi-agent API
→ PolarDB智能诊断

Supported Capabilities

支持的能力

CapabilityDescription
PolarDB Primary-Standby Switchover AnalysisFailover cause investigation, switchover log analysis, unexpected Failover diagnostics
PolarDB Kernel Parameter Change AssessmentImpact assessment before parameter modification, change risk analysis
PolarDB Kernel Parameter ExplanationParameter meaning explanation, configuration suggestions, performance impact analysis
PolarDB Kernel Parameter Explanation (IMCI)IMCI columnar engine related parameter explanation
PolarDB Kernel Version Proxy DiagnosticsProxy layer troubleshooting, version compatibility diagnostics
PolarDB Kernel Version Instance DiagnosticsInstance layer version issue diagnostics, upgrade suggestions
Instance Query FilterPolarDB instance search and filtering
Proxy Performance MonitoringProxy layer performance metrics analysis, connection routing diagnostics
Serverless ConfigurationServerless instance parameters and elastic scaling configuration
SQL Optimization AnalysisSlow SQL analysis, index suggestions, execution plan interpretation
Expiring Instance QuerySubscription instance expiration reminder
Backup Status CheckBackup completion, retention policy, recovery point in time
Storage Usage DiagnosticsStorage consumption analysis, growth trends, space optimization suggestions
Security Configuration AuditWhitelist, SSL, security policy audit
Instance Status CheckInstance health status, running status verification
Log DiagnosticsError log analysis, slow log troubleshooting
Auto-Increment ID Overflow DetectionAuto-increment ID exhaustion risk detection, primary key overflow warning
Connection and Session AnalysisConnection count monitoring, session issue troubleshooting, connection pool optimization
Cluster Performance MonitoringQPS/TPS/connections/throughput and other core metrics analysis
High Availability and Disaster RecoveryHA 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 Run
aliyun version
to verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] run
aliyun configure set --auto-plugin-install true
to enable automatic plugin installation.
bash
undefined
前置检查:要求Aliyun CLI版本 >= 3.3.1 运行
aliyun version
确认版本不低于3.3.1,如果未安装或版本过低,可参考references/cli-installation-guide.md的安装指引操作。然后**[必须]**运行
aliyun configure set --auto-plugin-install true
开启自动插件安装功能。
bash
undefined

Install 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

undefined
undefined

Parameter 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.
ParameterRequired/OptionalDescriptionDefault
query
RequiredNatural language query content (including region, cluster info)-
--session-id
OptionalSession ID for multi-turn conversation-
--profile
Optionalaliyun CLI profile namedefault
重要提示:参数确认 — 在执行任何命令或API调用前,所有用户可自定义参数(例如RegionId、实例名称、CIDR块、密码、域名、资源规格等)必须与用户确认,未经用户明确许可不得假设或使用默认值。
参数必选/可选描述默认值
query
必选自然语言查询内容(包含地域、集群信息)-
--session-id
可选多轮对话的会话ID-
--profile
可选aliyun CLI配置文件名default

Authentication

认证

Credentials use existing aliyun CLI configuration, no additional AK/SK setup required:
bash
undefined
凭证复用已有的aliyun CLI配置,无需额外配置AK/SK
bash
undefined

Recommended: 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
aliyun configure set
--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
undefined
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
undefined

RAM Policy

RAM策略

See references/ram-policies.md
参考references/ram-policies.md

Core Workflow

核心工作流

All intelligent O&M operations are invoked through
scripts/call_yaochi_agent.sh
, which wraps
aliyun das get-yao-chi-agent
(DAS plugin kebab-case command, supports Signature V3) with streaming response parsing.
bash
undefined
所有智能运维操作都通过
scripts/call_yaochi_agent.sh
调用,该脚本封装了
aliyun das get-yao-chi-agent
(DAS插件的短横线命名命令,支持Signature V3)并实现了流式响应解析。
bash
undefined

Cluster 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 -
undefined
echo "List clusters" | bash $SKILL_DIR/scripts/call_yaochi_agent.sh -
undefined

Example Questions

示例问题

ScenarioExample Question
Cluster ManagementList nodes of cluster pc-xxx
Performance DiagnosticsHow to troubleshoot high CPU usage in cluster pc-xxx
Slow SQL AnalysisShow slow SQL in cluster pc-xxx in the last hour
Parameter TuningWhat does loose_polar_log_bin parameter mean
IMCI ParametersHow to configure IMCI related parameters for cluster pc-xxx
Primary-StandbyHow to handle high primary-standby delay in cluster pc-xxx
Backup RecoveryWhen was the latest backup of cluster pc-xxx
Storage OptimizationWhat to do if storage usage of cluster pc-xxx grows too fast
Connection TroubleshootingCluster pc-xxx connections are full
Security AuditCheck 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

最佳实践

  1. Cluster ID Format: PolarDB cluster IDs typically start with
    pc-
    , include the full cluster ID in queries
  2. Region Specification: Explicitly specify region in natural language queries (e.g., "Hangzhou region", "Beijing region") to improve query accuracy
  3. Multi-turn Conversation: Use
    --session-id
    for complex diagnostic scenarios to maintain context continuity
  4. Concurrency Limit: Maximum 2 concurrent sessions per account, avoid initiating multiple parallel calls
  5. High-risk Operations: For operations involving parameter changes, primary-standby switchover, always remind users to verify in test environment first
  6. Throttling Handling: If encountering
    Throttling.UserConcurrentLimit
    error, wait for previous query to complete and retry
  7. Credential Security: Use
    aliyun configure
    to manage credentials, never hardcode AK/SK in scripts
  1. 集群ID格式:PolarDB集群ID通常以
    pc-
    开头,查询时请传入完整的集群ID
  2. 指定地域:自然语言查询中请明确说明地域(例如“杭州地域”、“北京地域”)以提升查询准确率
  3. 多轮对话:复杂诊断场景下使用
    --session-id
    保持上下文连续性
  4. 并发限制:每个账号最多同时存在2个会话,避免发起多个并行调用
  5. 高风险操作:涉及参数变更、主备切换的操作,请始终提醒用户先在测试环境验证
  6. 限流处理:如果遇到
    Throttling.UserConcurrentLimit
    错误,请等待上一次查询完成后重试
  7. 凭证安全:使用
    aliyun configure
    管理凭证,禁止在脚本中硬编码AK/SK

Reference Links

参考链接

ReferenceDescription
references/cli-installation-guide.mdAliyun CLI installation and configuration guide
references/related-apis.mdRelated API and CLI command list
references/ram-policies.mdRAM permission policy list
references/verification-method.mdSuccess verification methods
references/acceptance-criteria.mdAcceptance criteria
参考文档描述
references/cli-installation-guide.mdAliyun CLI安装与配置指南
references/related-apis.md相关API与CLI命令列表
references/ram-policies.mdRAM权限策略列表
references/verification-method.md成功验证方法
references/acceptance-criteria.md验收标准