
Byted Volcengine Flink
- 31 installs
- 411 repo stars
- Updated August 4, 2026
- bytedance/agentkit-samples
byted-volcengine-flink is a Claude skill that manages Volcengine Flink workloads by routing to four sub-skills and executing tools through flink-mcp.
About
This skill is an aggregator entrypoint for managing Volcengine Flink (based on Apache Flink) workloads. It routes requests to four sub-skills for developing and deploying streaming and batch SQL jobs, read-only diagnosis, resource and fault analysis, and SRE actions like stop, start, restart, scale, and config changes. It executes tools through flink-mcp and requires user confirmation before any change operation.
- Aggregator entrypoint for Volcengine Flink (Apache Flink) workloads
- Routes to four sub-skills: dev, diagnosis, resource, SRE
- Executes tools through flink-mcp
Byted Volcengine Flink by the numbers
- 31 all-time installs (skills.sh)
- Ranked #784 of 1,039 Cloud & Infrastructure skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
byted-volcengine-flink capabilities & compatibility
Requires Volcengine access keys and a Flink project; depends on flink-mcp and mcporter.
- Capabilities
- byted volcengine cloudmonitor
- Works with
- kafka
- Use cases
- devops · orchestration
- Runs
- Runs locally
- Pricing
- Bring your own API key
What byted-volcengine-flink says it does
Entrypoint for managing Volcengine Flink (based on Apache Flink) workloads.
It intelligently routes requests to four specialized sub-skills and leverages flink-mcp for tool execution.
npx skills add https://github.com/bytedance/agentkit-samples --skill byted-volcengine-flinkAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 31 |
|---|---|
| repo stars | ★ 411 |
| Last updated | August 4, 2026 |
| Repository | bytedance/agentkit-samples ↗ |
What it does
Develop, deploy, diagnose, and run SRE actions on Volcengine Flink streaming and batch jobs via flink-mcp.
Who is it for?
Streaming/batch Flink job development, diagnosis, and SRE on Volcengine.
When should I use this skill?
Use for developing, deploying, diagnosing, or performing SRE actions on Volcengine Flink jobs.
By the numbers
- 4 specialized sub-skills
- 4 required env vars for flink-mcp
Files
Byted Volcengine Flink
火山引擎 Flink 聚合技能入口,用于统一处理 Flink 相关需求,并按意图转发到对应子技能文档。
前置环境
在安装并使用本技能前,需要先完成 flink-mcp 前置准备。
1) 安装并验证 mcporter
flink-dev.md、flink-resource.md、flink-sre.md 中的运维/诊断指令依赖 mcporter。
可按你的 Python 环境选择任一方式安装:
npm install -g mcporter安装后验证:
mcporter --help2) 配置必需环境变量
flink-mcp 启动依赖以下环境变量(缺一不可):
VOLCENGINE_ACCESS_KEYVOLCENGINE_SECRET_KEYVOLCENGINE_REGIONVOLCENGINE_PROJECT_NAME
示例:
export VOLCENGINE_ACCESS_KEY="your-access-key"
export VOLCENGINE_SECRET_KEY="your-secret-key"
export VOLCENGINE_REGION="cn-beijing"
export VOLCENGINE_PROJECT_NAME="your-flink-project"3) 在本地 MCP 配置文件中注册 flink-mcp(推荐)
将 flink-mcp 加入本地 MCP Client 使用的配置文件(通常为 mcp.json 或等效配置文件)。
说明:MCP Client 会根据这段配置拉起 flink-mcp,因此这是默认主路径。
先确保本地已安装 uv / uvx,然后写入如下配置:
{
"mcpServers": {
"mcp-server-flink": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_flink",
"mcp-server-flink",
"-t",
"streamable-http"
],
"env": {
"VOLCENGINE_ACCESS_KEY": "${VOLCENGINE_ACCESS_KEY}",
"VOLCENGINE_SECRET_KEY": "${VOLCENGINE_SECRET_KEY}",
"VOLCENGINE_REGION": "${VOLCENGINE_REGION}",
"VOLCENGINE_PROJECT_NAME": "${VOLCENGINE_PROJECT_NAME}",
"UV_INDEX_URL": "https://mirrors.ivolces.com/pypi/simple/"
}
}
}
}4) 可选:手动启动 flink-mcp(仅用于联调/排障)
当需要独立验证服务是否可启动时,可在终端手动执行:
uvx --from git+https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_flink mcp-server-flink -t streamable-http子技能引用与路由
根据用户需求,将任务路由到以下子技能:
- 开发/部署 Flink SQL:
flink-dev.md - 只读诊断(禁止变更操作):
flink-diagnosis.md - 资源与故障分析:
flink-resource.md - SRE 运维变更(启停/重启/扩缩容/参数修改):
flink-sre.md
路由规则
1. 用户表达“创建 SQL / 开发 SQL / 部署 SQL / 调试 SQL”时,优先使用 flink-dev.md。 2. 用户明确要求“只读排查、不做任何变更”时,必须使用 flink-diagnosis.md。 3. 用户询问故障根因、OOM、Checkpoint、性能问题、连接问题时,优先使用 flink-resource.md。 4. 用户要求执行运维动作(启动、停止、重启、扩容、缩容、改配置)时,必须使用 flink-sre.md,且先做风险确认。
执行原则
- 在信息不足时,先补齐关键参数:项目名、任务名、时间范围、目标动作。
- 任何变更类操作(尤其在
flink-sre.md中)都必须先让用户确认风险。 - 当用户只需要排查时,坚持只读工具链,不触发启动/停止/部署等动作。
Flink SQL Development and Deployment Skill
自动化创建、开发、部署和调试 Flink SQL 任务。
核心流程
1. 信息提取
从用户提问中提取关键信息:
- Flink 项目名 (project_name)
- 任务名 (job_name)
- SQL 逻辑描述:用户想要实现的业务逻辑
- 数据源:Kafka、Paimon、MySQL 等
- 数据目标:输出到哪里
如果用户没有明确提供,主动询问缺失的关键信息。
2. SQL 代码生成
根据用户的逻辑描述,生成 Flink SQL 代码。
**生成 SQL 时需要考虑:
- 数据源的连接配置(Kafka、Paimon、MySQL 等)
- 数据表的 schema 定义
- 业务逻辑的实现
- 水位线(Watermark)设置
- 窗口函数(如需要)
- 输出目标的配置
**向用户展示生成的 SQL 代码,并询问是否需要调整和优化。
3. SQL 逻辑确认
在用户确认 SQL 逻辑后,再继续后续步骤。
在执行任何变更操作前,必须向用户确认!
4. 创建和部署流程
步骤 1:创建应用草稿
使用 mcporter call volceapi.create_flink_application_draft 创建应用草稿。
命令格式:
mcporter call volceapi.create_flink_application_draft project_name="xxx" job_name="xxx" ...步骤 2:获取应用草稿
使用 mcporter call volceapi.get_flink_application_draft 获取应用草稿,检查 SQL 代码。
命令格式:
mcporter call volceapi.get_flink_application_draft project_name="xxx" job_name="xxx"步骤 3:更新应用草稿
如果需要修改 SQL 代码或配置,使用 mcporter call volceapi.update_flink_application_draft 更新应用草稿。
命令格式:
mcporter call volceapi.update_flink_application_draft project_name="xxx" job_name="xxx" ...步骤 4:部署应用草稿
使用 mcporter call volceapi.deploy_flink_application_draft 部署应用草稿。
命令格式:
mcporter call volceapi.deploy_flink_application_draft project_name="xxx" job_name="xxx"步骤 5:启动应用
使用 mcporter call volceapi.start_flink_application 启动已部署的应用。
重要:开发期间从全新启动,不要从 savepoint 恢复。
命令格式:
mcporter call volceapi.start_flink_application project_name="xxx" job_name="xxx"5. 调试流程
步骤 1:检查任务状态
使用 mcporter call volceapi.list_flink_application 检查任务状态。
步骤 2:获取应用日志
使用 mcporter call volceapi.list_flink_application_log 获取应用日志。
日志查询策略:
- 如果用户提供了故障时间,使用该时间范围
- 如果没有提供,查询最近 1 小时的日志
- 查询 ERROR 级别日志,同时查看 WARNING 级别
- 查询 JOBMANAGER 和 TASKMANAGER 组件的日志
命令格式:
mcporter call volceapi.list_flink_application_log \
project_name="xxx" \
job_name="xxx" \
start_time="YYYY-MM-DDTHH:MM:SS" \
end_time="YYYY-MM-DDTHH:MM:SS" \
level="ERROR"步骤 3:分析错误
如果发现异常报错:
1. 停止任务(仅停止当前正在调试的任务!)
mcporter call volceapi.stop_flink_application project_name="xxx" job_name="xxx"⚠️ 重要:只能停止用户明确要求调试的任务,绝对不能停止其他任务!
2. 根据报错信息更新应用草稿
mcporter call volceapi.update_flink_application_draft project_name="xxx" job_name="xxx" ...3. 重新部署应用草稿
mcporter call volceapi.deploy_flink_application_draft project_name="xxx" job_name="xxx"4. 重新启动应用
mcporter call volceapi.start_flink_application project_name="xxx" job_name="xxx"5. 重新检查日志,确认是否还有错误
步骤 4:重复调试循环
重复上述步骤,直到任务启动后没有报错。
6. 验证正常运行
当任务启动后没有报错,才算正常运行。
向用户提供以下信息:
- 任务状态
- 任务配置信息
- 运行时信息
- Flink UI 地址
- 后续使用建议
重要安全规则
⚠️ 绝对不能做的事情
1. 绝对不能停止不相关的任务
- 只能停止用户明确要求调试的任务
- 在停止任务前,必须明确确认是当前正在调试的任务
- 如果有任何疑问,先询问用户,不要擅自停止
2. 绝对不能修改不相关的任务
- 只能修改用户明确要求开发/调试的任务
- 在修改任务前,必须明确确认
3. 绝对不能部署不相关的任务
- 只能部署用户明确要求开发/调试的任务
✅ 必须做的事情
1. 明确任务范围
- 在执行任何操作前,明确确认是哪个任务
- 向用户重复确认任务名和项目名
2. 风险确认
- 在执行任何变更操作前,向用户确认风险
- 明确说明可能的影响
3. 操作后验证
- 执行操作后,验证操作结果
- 确认没有影响其他任务
输出格式
SQL 代码生成反馈
# 📝 Flink SQL 代码生成
## 📋 任务信息
- **项目名**: [项目名]
- **任务名**: [任务名]
- **业务逻辑**: [业务逻辑描述]
## 💻 生成的 SQL 代码[生成的 SQL 代码]
## ❓ 确认问题
1. SQL 逻辑是否正确?
2. 是否需要调整或优化?
3. 确认后继续部署?(yes/no)操作风险确认
⚠️ **操作风险确认**
您将要执行以下操作:
- **操作类型**: [创建/部署/启动/停止/调试]
- **目标任务**: [项目名] / [任务名]
- **当前状态**: [当前状态]
- **变更内容**: [具体变更内容]
**潜在风险**:
- [列出可能的风险]
**重要**:此操作只会影响 [任务名],不会影响其他任务。
请确认是否继续执行此操作?(yes/no)调试流程反馈
# 🔍 Flink SQL 任务调试
## 📋 任务信息
- **项目名**: [项目名]
- **任务名**: [任务名]
- **当前状态**: [当前状态]
## 🐛 错误信息
[发现的错误信息]
## 🔧 修复方案
[修复方案描述]
## ❓ 确认问题
是否按照此方案修复?(yes/no)成功完成反馈
# ✅ Flink SQL 任务开发完成
## 📋 任务信息
- **项目名**: [项目名]
- **任务名**: [任务名]
- **当前状态**: [当前状态]
- **完成时间**: [时间]
## 📊 任务配置
[关键配置信息]
## 🌐 Flink UI
[Flink UI 地址]
## 💡 后续建议
[后续使用建议]常用 Flink SQL 模板
Kafka 源表模板
CREATE TABLE source_table (
-- 字段定义
) WITH (
'connector' = 'kafka',
'topic' = 'topic-name',
'properties.bootstrap.servers' = 'kafka-server:9092',
'properties.group.id' = 'group-id',
'scan.startup.mode' = 'latest-offset',
'format' = 'json'
);Paimon 目标表模板
CREATE TABLE sink_table (
-- 字段定义
) WITH (
'connector' = 'paimon',
'path' = 'tos://bucket/path',
'warehouse' = 'tos://bucket/path',
'auto-create' = 'true'
);带 Watermark 的流处理
CREATE TABLE source_table (
-- 字段定义
event_time TIMESTAMP(3),
WATERMARK FOR event_time AS event_time - INTERVAL '5' SECOND
) WITH (
-- 连接器配置
);工具调用顺序
创建 SQL 任务开发完整流程
1. 信息提取 - 从用户提问中提取信息 2. SQL 代码生成 - 根据逻辑描述生成 SQL 3. 用户确认 SQL - 向用户展示 SQL,等待确认 4. 风险确认 - 向用户确认风险 5. 创建应用草稿 - create_flink_application_draft 6. 获取应用草稿 - get_flink_application_draft 7. 更新应用草稿 - update_flink_application_draft(如需要) 8. 部署应用草稿 - deploy_flink_application_draft 9. 启动应用 - start_flink_application 10. 检查任务状态 - list_flink_application 11. 获取日志 - list_flink_application_log 12. 分析错误 - 如果有错误,停止任务 → 更新 → 重新部署 → 重新启动 13. 重复调试循环 - 直到没有错误 14. 验证正常运行 - 提供最终结果
调试循环(发现错误时)
1. 获取日志 - list_flink_application_log 2. 分析错误 3. 停止任务 - stop_flink_application(⚠️ 仅停止当前调试的任务!) 4. 更新应用草稿 - update_flink_application_draft 5. 部署应用草稿 - deploy_flink_application_draft 6. 启动应用 - start_flink_application 7. 检查日志 - 确认是否还有错误 8. 重复 - 直到没有错误
注意事项
1. 任务范围确认:在执行任何操作前,明确确认是哪个任务 2. 绝不影响其他任务:绝对不能停止、修改、部署不相关的任务 3. 风险确认:在执行任何变更操作前,必须向用户确认风险 4. 先获取信息:在执行操作前,先获取应用的详细信息 5. 验证操作结果:操作执行完成后,必须验证结果 6. 提供清晰反馈:向用户提供清晰的操作结果和后续建议 7. 使用友好语言:用用户能理解的语言解释操作和风险 8. 避免过度技术化:除非用户要求,否则避免过度技术化的解释 9. 错误处理:如果操作失败,向用户说明失败原因,并提供解决方案 10. 调试循环:调试时,要有耐心,重复直到成功
Flink Job Diagnostic Skill
自动采集日志与指标,诊断任务故障、OOM、Checkpoint 及反压问题,输出根因报告与修复建议。
适用场景
1. 任务状态监控:查看 Flink 任务的运行状态、延迟指标、资源使用情况 2. 异常问题排查:当任务出现失败、延迟过高、性能瓶颈等问题时,进行根因分析 3. 运行日志查询:获取 JobManager、TaskManager 的运行日志,排查错误信息 4. 事件信息查询:查看任务运行过程中的事件记录,了解任务生命周期变化 5. 资源使用分析:查询资源池配置、项目列表、目录结构等基础信息
工具列表(仅包含只读工具)
1. 项目与资源查询类
| 工具名称 | 功能描述 |
|---|---|
list_flink_project | 查询 Flink 项目列表,支持关键词搜索 |
list_flink_directory | 查询 Flink 目录列表,可按项目过滤 |
list_flink_resource_pool | 查询资源池信息,包含计费模式、资源配置等 |
2. 任务基础信息查询类
| 工具名称 | 功能描述 |
|---|---|
list_flink_application | 查询 Flink 任务列表,支持按项目、名称、状态、类型等多维度过滤 |
get_flink_application_detail | 查询单个任务的详细配置信息 |
get_flink_runtime_application_info | 查询任务的运行时信息,包含 JobManager、TaskManager 的 Pod 列表和资源指标 |
3. 诊断排查类
| 工具名称 | 功能描述 |
|---|---|
list_flink_application_log | 查询任务运行日志,支持按时间范围、日志级别、组件类型过滤,支持分页 |
get_flink_application_event | 查询任务的事件记录,了解任务运行过程中的状态变化 |
诊断流程指南
第一步:基础信息收集
1. 查询项目列表:list_flink_project(search_key="项目关键词") 2. 查询任务列表:list_flink_application(project_name="项目名", job_state="RUNNING") 3. 定位到异常任务后,获取任务详情:get_flink_application_detail(project_name="项目名", job_name="任务名")
第二步:运行状态分析
1. 获取运行时信息:get_flink_runtime_application_info(project_name="项目名", job_name="任务名") 2. 查看延迟指标:从运行时信息中查看 currentEmitEventTimeLag 业务延迟指标 3. 检查资源使用:查看 JobManager、TaskManager 的资源分配和使用情况
第三步:异常问题排查
1. 查看事件记录:get_flink_application_event(project_name="项目名", job_name="任务名", limit=100) 2. 查询错误日志:
list_flink_application_log(
project_name="项目名",
job_name="任务名",
start_time="2025-10-30T19:00:00",
end_time="2025-10-30T20:00:00",
level="ERROR",
component="jobmanager"
)3. 如果是 TaskManager 报错,修改 component="taskmanager" 进一步排查
第四步:性能瓶颈分析
1. 查看日志中的慢查询、背压等相关警告信息 2. 检查资源池配置是否满足任务需求:list_flink_resource_pool(project_name="项目名", name="资源池名")
使用示例
示例1:查询所有运行中的任务
list_flink_application(job_state="RUNNING")示例2:查询指定任务最近1小时的错误日志
list_flink_application_log(
project_name="my_project",
job_name="my_flink_job",
start_time="2025-10-30T19:00:00",
end_time="2025-10-30T20:00:00",
level="ERROR"
)示例3:查询任务的运行时信息
get_flink_runtime_application_info(
project_name="my_project",
job_name="my_flink_job"
)注意事项
1. 只读原则:本技能仅使用上述列出的只读工具,禁止使用 start_flink_application、stop_flink_application、restart_flink_application、deploy_flink_application_draft 等运维类工具 2. 日志查询限制:单次日志查询的时间范围建议不超过24小时,避免返回数据量过大 3. 分页处理:当日志量较大时,使用 cursor 参数进行分页查询 4. 数据安全:查询结果中可能包含敏感信息,请注意数据保密
Flink Job Resource Analysis Skill
分析资源池水位与任务 CU 消耗,识别僵尸任务并生成降本建议。
核心流程
1. 信息提取
从用户提问中提取关键信息:
- Flink 项目名 (project_name)
- 任务名 (job_name)
- 故障问题描述
- 故障发生时间 (用于日志查询)
- 区域 (region,可选)
如果用户没有明确提供,主动询问缺失的关键信息。
2. 获取应用列表
使用 mcporter call volceapi.list_flink_application 获取应用列表,支持按以下条件过滤:
- project_name(项目名)
- job_name(任务名)
- job_state(任务状态:ALL/CREATED/STARTING/RUNNING/FAILED/CANCELLING/SUCCEEDED/STOPPED)
- job_type(任务类型)
- resource_pool(资源池)
- region(区域)
3. 获取详细信息
对于找到的应用,获取以下详细信息:
应用详情:
mcporter call volceapi.get_flink_application_detail project_name="xxx" job_name="xxx"运行时信息:
mcporter call volceapi.get_flink_runtime_application_info project_name="xxx" job_name="xxx"4. 获取诊断信息
应用日志:
- 如果用户提供了故障时间,使用该时间范围
- 如果没有提供,查询最近 1 小时的日志
- 默认查询 ERROR 级别日志,同时查看 WARNING 级别
- 查询 JOBMANAGER 和 TASKMANAGER 组件的日志
mcporter call volceapi.list_flink_application_log \
project_name="xxx" \
job_name="xxx" \
start_time="YYYY-MM-DDTHH:MM:SS" \
end_time="YYYY-MM-DDTHH:MM:SS" \
level="ERROR"应用事件:
mcporter call volceapi.get_flink_application_event project_name="xxx" job_name="xxx" limit=505. 资源池检查
当发现以下情况时,检查资源池:
- OOM(内存溢出)
- TaskManager 丢失
- 容器被杀
- 任务启动失败
- 性能下降
mcporter call volceapi.list_flink_resource_pool project_name="xxx"异常分类系统
根据收集到的信息,将根异常分类为以下类别之一:
| 类别 | 典型信号 |
|---|---|
| Resource | OOM、TaskManager 丢失、容器被杀、堆空间不足、内存溢出、GC 频繁、资源耗尽 |
| Data | 反序列化错误、模式不匹配、NullPointerException、数据格式错误、类型转换异常 |
| Checkpoint | Checkpoint 超时/过期、状态后端错误、Checkpoint 失败、状态大小异常 |
| Connectivity | Kafka 不可达、连接拒绝/超时、网络异常、数据库连接失败、外部服务不可用 |
| Code/Logic | SQL 语法错误、UDF 异常、ClassCastException、业务逻辑错误、代码异常 |
| Configuration | 无效的并行度、参数缺失、资源配置过小、配置错误、环境变量缺失 |
| Infrastructure | 节点故障、网络分区、存储不可用、底层基础设施问题 |
| Snapshot | 文件未找到、快照过期太快、消费速度太慢、状态恢复失败 |
优先级区分
根据问题严重程度,标记优先级:
🔴 Critical — 任务宕机或数据丢失风险,需要立即采取行动。
- 任务已失败(FAILED)
- 任务已停止(STOPPED)
- 数据丢失风险
- 严重的资源耗尽
🟡 Warning — 性能下降或间歇性错误,建议采取行动。
- 任务运行但性能下降
- Checkpoint 超时但未失败
- 频繁的 GC 但未 OOM
- 间歇性连接问题
- 警告级别日志增多
🟢 Info — 健康或轻微的优化建议。
- 任务正常运行
- 轻微的性能优化空间
- 配置可以优化但不影响运行
诊断报告结构
ALWAYS 使用以下格式输出诊断报告:
# 🚨 Flink 任务智能诊断报告
## 📋 基本信息
- **项目名**: [项目名]
- **任务名**: [任务名]
- **当前状态**: [状态]
- **诊断时间**: [时间]
## 🔍 问题分析
### 异常类别
[类别 emoji] **[类别名称]**
### 优先级
[优先级 emoji] **[优先级名称]**
### 根本原因
[用通俗语言解释根本原因]
### 关键证据
- [证据 1]
- [证据 2]
- [证据 3]
## 💡 修复建议
### 1. 立即修复
[具体的修复步骤]
### 2. 预防措施
[如何避免问题再次发生]
### 3. 优化建议
[可选的性能优化建议]
## 📊 相关信息
[附上关键的日志片段、事件信息或运行时数据]修复建议模板
提供编号的、可操作的修复步骤:
1. 用通俗语言解释根本原因
- 技术细节,但用易懂的方式
2. 具体的修复方法
- 参数修改(如并行度、内存配置)
- SQL 修复
- 资源调整
- 代码修改建议
3. 预防措施
- 如何避免问题再次发生
- 监控建议
- 最佳实践
工具调用顺序
1. 先调用 list_flink_application 找到目标应用 2. 调用 get_flink_application_detail 获取应用详情 3. 调用 get_flink_runtime_application_info 获取运行时信息 4. 调用 list_flink_application_log 获取日志(ERROR + WARNING) 5. 调用 get_flink_application_event 获取事件 6. 如需要,调用 list_flink_resource_pool 检查资源池 7. 综合分析,分类异常,给出诊断报告
注意事项
- 始终先确认项目名和任务名
- 如果有多个应用匹配,让用户选择
- 日志查询时,如果没有明确时间,查询最近 1 小时
- 同时查看 ERROR 和 WARNING 级别的日志
- 检查 JOBMANAGER 和 TASKMANAGER 两个组件
- 遇到资源相关问题时,务必检查资源池
- 用用户能理解的语言解释,避免过度技术化
- 给出具体、可操作的建议,而不是模糊的指导
Flink SRE Automation Operations Skill
自动化管理 Serverless Flink 应用的启动、停止、重启、扩容、缩容、配置修改等运维操作。
核心流程
1. 信息提取
从用户提问中提取关键信息:
- Flink 项目名 (project_name)
- 任务名 (job_name)
- 操作类型:启动、停止、重启、扩容、缩容、修改配置等
- 具体参数:新的并行度、新的配置参数等
如果用户没有明确提供,主动询问缺失的关键信息。
2. 获取应用信息
使用 mcporter call volceapi.list_flink_application 获取应用列表,验证应用是否存在。
如果找到应用,使用以下工具获取详细信息:
get_flink_application_detail- 获取应用详情get_flink_runtime_application_info- 获取运行时信息
3. 风险确认
在执行任何变更操作前,必须向用户确认风险!
使用以下格式向用户确认:
⚠️ **操作风险确认**
您将要执行以下操作:
- **操作类型**:[启动/停止/重启/扩容/缩容/修改配置]
- **目标任务**:[项目名] / [任务名]
- **当前状态**:[当前状态]
- **变更内容**:[具体变更内容]
**潜在风险**:
- [列出可能的风险,如任务中断、数据丢失、性能影响等]
请确认是否继续执行此操作?(yes/no)只有当用户明确确认(回复 yes、确认、继续等)后,才继续执行操作。
4. 执行操作
启动任务
使用 mcporter call volceapi.start_flink_application 启动任务。
命令格式:
mcporter call volceapi.start_flink_application project_name="xxx" job_name="xxx"停止任务
使用 mcporter call volceapi.stop_flink_application 停止任务。
命令格式:
mcporter call volceapi.stop_flink_application project_name="xxx" job_name="xxx"重启任务
使用 mcporter call volceapi.restart_flink_application 重启任务。
命令格式:
mcporter call volceapi.restart_flink_application project_name="xxx" job_name="xxx"扩容/缩容任务
扩容/缩容需要以下步骤:
⚠️ 重要原则: 1. 必须首先获取原先的任务配置 - 使用 get_flink_application_draft 获取完整的当前配置 2. 只修改并行度这一个参数 - 绝对不能修改其他任何配置参数 3. 保持其他所有配置不变 - 确保只更新 parallelism.default 这一个参数 4. 使用完整配置更新 - 更新时传入完整的配置,只修改并行度字段
详细步骤: 1. 获取当前应用草稿 - 使用 get_flink_application_draft 获取完整的当前配置 2. 展示当前配置给用户确认 - 向用户展示当前的并行度和其他配置 3. 只修改并行度配置 - 只修改 parallelism.default 这一个参数,其他所有配置保持原样 4. 更新应用草稿 - 使用 update_flink_application_draft,传入完整的配置(只修改并行度) 5. 部署应用草稿 - deploy_flink_application_draft 6. 重启任务 - restart_flink_application
关键验证点:
- 更新前必须向用户确认:"我们只会修改并行度这一个参数,其他配置保持不变,确认吗?"
- 更新后必须验证:并行度是否正确变更,其他配置是否保持不变
修改配置参数
修改配置参数需要以下步骤: 1. 获取应用草稿:get_flink_application_draft 2. 更新应用草稿:update_flink_application_draft(修改配置参数) 3. 部署应用草稿:deploy_flink_application_draft 4. 重启任务:restart_flink_application
详细步骤: 1. 首先获取当前应用草稿 2. 修改指定的配置参数 3. 部署新的草稿版本 4. 重启任务使配置生效
5. 验证操作结果
操作执行完成后,使用以下工具验证结果:
list_flink_application- 查看任务状态是否变更get_flink_application_detail- 查看最新的应用详情get_flink_runtime_application_info- 查看运行时信息
向用户报告操作结果。
操作类型说明
| 操作类型 | 描述 | 需要确认 |
|---|---|---|
| 启动任务 | 启动已停止的 Flink 任务 | ✅ 是 |
| 停止任务 | 停止正在运行的 Flink 任务 | ✅ 是 |
| 重启任务 | 重启 Flink 任务(先停止再启动) | ✅ 是 |
| 扩容任务 | 增加任务的并行度 | ✅ 是 |
| 缩容任务 | 减少任务的并行度 | ✅ 是 |
| 修改配置 | 修改 Flink 任务的配置参数 | ✅ 是 |
风险提示模板
启动任务风险
- 任务启动可能需要较长时间
- 如果任务有积压数据,启动后可能需要时间追赶
- 启动失败可能需要手动干预
停止任务风险
- 任务停止后,数据处理将中断
- 可能导致数据延迟
- 停止失败可能需要手动干预
重启任务风险
- 任务会短暂中断
- 可能导致数据延迟
- 重启失败可能需要手动干预
- Checkpoint 可能需要重新开始
扩容/缩容风险
- 任务会重启,导致短暂中断
- 可能导致数据延迟
- 扩容后可能需要更多资源
- 缩容可能影响处理性能
- 重新部署可能失败
修改配置风险
- 任务会重启,导致短暂中断
- 可能导致数据延迟
- 配置错误可能导致任务启动失败
- 需要验证新配置的正确性
输出格式
ALWAYS 使用以下格式输出操作结果:
# ⚙️ Flink SRE 操作执行结果
## 📋 操作信息
- **操作类型**: [操作类型]
- **项目名**: [项目名]
- **任务名**: [任务名]
- **执行时间**: [时间]
## ✅ 操作结果
[描述操作是否成功]
## 📊 当前状态
- **任务状态**: [当前状态]
- **并行度**: [当前并行度]
- **其他关键信息**: [其他信息]
## 💡 后续建议
[给出后续操作建议]注意事项
重要:扩容/缩容的特殊要求
⚠️ 扩容/缩容时必须遵守以下规则:
1. 必须首先获取原先的任务配置 - 使用 get_flink_application_draft 获取完整的当前配置 2. 绝对不能修改其他参数 - 只能修改 parallelism.default 这一个参数 3. 保持其他所有配置不变 - 所有其他配置必须与原配置完全一致 4. 使用完整配置更新 - 更新时传入完整的配置,只修改并行度字段 5. 向用户明确说明 - 在操作前向用户说明:"我们只会修改并行度这一个参数,其他配置保持不变" 6. 操作后验证 - 验证并行度是否正确变更,其他配置是否保持不变
通用注意事项
1. 始终先确认风险:在执行任何变更操作前,必须向用户确认风险 2. 先获取应用信息:在执行操作前,先获取应用的详细信息 3. 验证操作结果:操作执行完成后,必须验证结果 4. 提供清晰的反馈:向用户提供清晰的操作结果和后续建议 5. 使用友好的语言:用用户能理解的语言解释操作和风险 6. 避免过度技术化:除非用户要求,否则避免过度技术化的解释 7. 错误处理:如果操作失败,向用户说明失败原因,并提供解决方案
常用配置参数
以下是一些常用的 Flink 配置参数,可以通过修改配置来调整:
parallelism.default- 默认并行度taskmanager.memory.process.size- TaskManager 内存大小jobmanager.memory.process.size- JobManager 内存大小taskmanager.numberOfTaskSlots- TaskManager slot 数量execution.checkpointing.interval- Checkpoint 间隔execution.checkpointing.timeout- Checkpoint 超时时间restart-strategy- 重启策略state.backend.type- 状态后端类型
工具调用顺序
启动任务
1. list_flink_application - 验证应用存在 2. 风险确认 - 向用户确认风险 3. start_flink_application - 启动任务 4. list_flink_application - 验证操作结果
停止任务
1. list_flink_application - 验证应用存在 2. 风险确认 - 向用户确认风险 3. stop_flink_application - 停止任务 4. list_flink_application - 验证操作结果
重启任务
1. list_flink_application - 验证应用存在 2. 风险确认 - 向用户确认风险 3. restart_flink_application - 重启任务 4. list_flink_application - 验证操作结果
扩容/缩容任务
1. list_flink_application - 验证应用存在 2. get_flink_application_draft - 获取完整的当前配置 3. 展示当前配置 - 向用户展示当前的并行度和其他配置 4. 参数修改确认 - 向用户确认:"我们只会修改并行度这一个参数,其他配置保持不变,确认吗?" 5. 风险确认 - 向用户确认风险 6. update_flink_application_draft - 只修改并行度这一个参数,保持其他所有配置不变 7. deploy_flink_application_draft - 部署新草稿 8. restart_flink_application - 重启任务 9. list_flink_application - 验证操作结果 10. 验证配置变更 - 验证并行度是否正确变更,其他配置是否保持不变
修改配置
1. list_flink_application - 验证应用存在 2. get_flink_application_draft - 获取应用草稿 3. 风险确认 - 向用户确认风险 4. update_flink_application_draft - 更新配置参数 5. deploy_flink_application_draft - 部署新草稿 6. restart_flink_application - 重启任务 7. list_flink_application - 验证操作结果
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Related skills
FAQ
How does it execute Flink actions?
It leverages flink-mcp for tool execution and routes intents to four specialized sub-skills (dev, diagnosis, resource, SRE).
What is required before change operations?
Any change operation, especially in flink-sre, must first have the user confirm the risk.