跳到正文
Skillpedia
数据库9.5k · #12279

diagnose_replication_lag

它能做什么

这项技能检查从另一台服务器复制数据的数据库副本的健康状况。适合需要了解副本是否延迟或已停止的数据库管理员。

适用场景

  • ✓当你的副本数据库似乎显示的是旧数据时。
  • ✓当复制可能已停止,你需要了解错误原因时。
  • ✓当你想检查副本落后了多少时。

技能链接

https://github.com/major/MySQLTuner-perl/blob/master/.agent/skills/diagnose-replication-lag/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/major/MySQLTuner-perl/blob/master/.agent/skills/diagnose-replication-lag/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请检查我的 MySQL 副本是否落后于主服务器,并告诉我是否有复制线程失败。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会使用只读命令读取副本的状态,检查复制线程是否正在运行,测量延迟,并在某个线程失败时报告确切的错误。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

AI Skill: Database Replication Latency & Health Diagnostics

🧠 Purpose & Operational Objectives

The diagnose_replication_lag skill allows AI agents to monitor binary log transport latency, parallel worker thread concurrency, and replication thread failures in master-replica and multi-source topologies.

📋 Preconditions & Context

  • Server configured as a MySQL or MariaDB replica/slave node.
  • Read-only queries executed (SHOW REPLICA STATUS or SHOW SLAVE STATUS).
  • Compatible with legacy (SLAVE) and modern (REPLICA) keywords.

🛠️ Input Parameters

Parameter Type Required Default Description
max_acceptable_lag_seconds integer No 30 Threshold in seconds above which replication is considered degraded.
channel_name string No "" Multi-source replication channel identifier (optional).

📊 Status Evaluation

  1. NOT_A_REPLICA: No replication configuration detected on the instance.
  2. THREAD_FAILED: Slave_IO_Running != 'Yes' or Slave_SQL_Running != 'Yes'. Returns exact SQL/IO error code and message.
  3. DEGRADED_LAG: Threads running, but Seconds_Behind_Master > max_acceptable_lag_seconds.
  4. HEALTHY: Both threads running and latency within acceptable bounds.

🛡️ Guardrails & Remediation

  • Automatically suggests parallel worker thread tuning (replica_parallel_workers, replica_parallel_type = 'LOGICAL_CLOCK') to absorb heavy write streams.
  • Provides rollback commands for all global variables.
常见问题

这项技能会更改副本吗?

不会。它只读取状态,不做任何更改。

这里的延迟是什么意思?

它是副本落后于主服务器的秒数,并与你设置的限制进行比较。

它支持多个数据源吗?

支持。如果你指定某个复制通道,它可以检查该通道。

详情

作者的原始描述

Diagnoses MySQL and MariaDB replication latency, IO/SQL thread failures, GTID synchronization, and parallel worker saturation.

repo: major/MySQLTuner-perl

热度

GitHub 星标
9.5k
排名
#12279
许可证
GPL-3.0
更新时间
2026/10/28

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能