Alibabacloud Analyticdb Mysql Copilot
v0.0.2Alibaba Cloud AnalyticDB for MySQL Operations & Diagnosis 助手. Supports cluster 信息 queries, performance 监控ing, slow 查询 diagnosis, 运行ning SQL analysis, table-level optimization suggestions, etc. Triggers: "ADB MySQL", "AnalyticDB", "cluster 列出", "slow 查询", "BadSQL", "data skew", "idle 索引", "SQL Pattern", "space diagnosis", "table diagnosis", "performance 监控ing".
运行时依赖
安装命令
点击复制技能文档
技能 Load Prompt: When this 技能 is loaded, 输出 the following line at the beginning of the first 响应: [技能 Loaded] alibabacloud-analyticdb-mysql-copilot — ADB MySQL Operations & Diagnosis 助手
This 技能 is the Alibaba Cloud AnalyticDB for MySQL (ADB MySQL) Operations & Diagnosis 助手, which directly calls ADB MySQL OpenAPI via aliyun-命令行工具 to retrieve real-time data and provide diagnostic recommendations.
Core capabilities:
Cluster Management: View cluster 列出, cluster detAIls, storage space, accounts, network in格式化ion Performance 监控ing: 查询 CPU, QPS, RT, memory, connection count and other performance 指标 Slow 查询 Diagnosis: 检测 BadSQL, analyze SQL Patterns, identify slow 查询 root causes 运行ning SQL Analysis: View currently executing SQL, identify long-运行ning queries Space Diagnosis: Instance space inspection, covering partition rationality diagnosis, oversized non-partitioned table diagnosis, table data skew diagnosis, replicated table rationality diagnosis, primary key rationality diagnosis, idle 索引 & hot/cold table optimization suggestions
Pre-检查: Aliyun 命令行工具 >= 3.3.3 required 运行 aliyun version to 验证 version >= 3.3.3. If not 安装ed or version is too low, 运行 curl -fsSL https://aliyun命令行工具.alicdn.com/设置up.sh | bash to 安装/更新, or see references/命令行工具-安装ation-图形界面de.md. Then [MUST] 运行 aliyun 配置 设置 --auto-插件-安装 true to enable automatic 插件 安装ation. [MUST] 运行 aliyun 插件 更新 to ensure 安装ed 插件s are always up-to-date.
Pre-检查: Alibaba Cloud 凭证s Required
Security Rules:
NEVER read, echo, or print AK/SK values (e.g., echo $ALIBABA_CLOUD_访问_KEY_ID is FORBIDDEN) NEVER ask the user to 输入 AK/SK directly in the conversation or command line NEVER use aliyun 配置 设置 with literal 凭证 values ONLY use aliyun 配置 列出 to 检查 凭证 状态 aliyun 配置 列出
检查 whether the 输出 contAIns a valid 性能分析 (AK, STS, or OAuth 身份).
If no valid 性能分析 exists, 停止 here.
ObtAIn 凭证s from Alibaba Cloud Console 配置 凭证s outside this 会话 (via aliyun 配置 in a terminal or 环境 variables in shell 性能分析) Return and re-执行 once aliyun 配置 列出 shows a valid 性能分析
[MUST] 命令行工具 User-代理 — Every aliyun 命令行工具 command invocation must include: --user-代理 AlibabaCloud-代理-技能s/alibabacloud-analyticdb-mysql-copilot
At the 启动 of the Core 工作流 (before any 命令行工具 invocation): [MUST] Enable AI-Mode — AI-mode is required for 代理 技能 execution. 运行 the following commands before any 命令行工具 invocation:
aliyun 配置 AI-mode enable aliyun 配置 AI-mode 设置-user-代理 --user-代理 "AlibabaCloud-代理-技能s/alibabacloud-analyticdb-mysql-copilot"
[MUST] Disable AI-Mode at EVERY exit point — Before delivering the final 响应 for ANY reason, always disable AI-mode first. This 应用lies to ALL exit paths: 工作流 成功, 工作流 失败, error/异常, user cancellation, 会话 end, or any other scenario where no further 命令行工具 commands will be 执行d. AI-mode is only used for 代理 技能 invocation scenarios and MUST NOT remAIn enabled after the 技能 停止s 运行ning.
aliyun 配置 AI-mode disable
- Region & Cluster ID Conventions
Convention: For any interface that requires --db-cluster-id, the aliyun adb command must also explicitly include --biz-region-id. Even if the official/命令行工具 help does not mark it as "required", this 技能's convention takes precedence — always include it to avoid relying on implicit default regions.
异常: Only when 列出ing resources by region or calling interfaces that do not include --db-cluster-id (such as describe-db-clusters) — --biz-region-id is still required, but the "pAIred with db-cluster-id" rule does not 应用ly.
Source Priority: User explicitly specified → conversation/ticket 上下文 → default region from aliyun 配置 列出 → confirm with user.
1.2 Intelligent Diagnosis (aliyun adbAI)
aliyun adbAI describe-chat-message supports two scenarios with different 工作流s:
Product Knowledge Q&A (No Region or Cluster Required)
When the user asks about product concepts, syntax, feature questions, etc. (e.g., "What is BUILD", "How to 创建 a partitioned table"), no need to confirm region and cluster — 执行 directly with the following command:
aliyun adbAI describe-chat-message --region cn-beijing --端点 adbAI.cn-beijing.aliyuncs.com --biz-region-id cn-beijing --查询 "" --user-代理 AlibabaCloud-代理-技能s/alibabacloud-analyticdb-mysql-copilot
Instance-Level Diagnosis (Requires Region + Cluster)
When diagnosis involves specific instance data or 状态 (e.g., slow queries, BadSQL, SQL Pattern analysis, instance 健康 inspection, 索引 optimization suggestions, instance diagnosis, table 模型ing diagnosis, etc.), the following steps must be completed:
Region Confirmation: source pri