Skip to content
Skillpedia
Databases9.5k · #12279

diagnose_replication_lag

What it does

This skill checks the health of a database replica that copies data from another server. It is for database admins who need to know if the copy is lagging or has stopped.

When to use it

  • ✓When your replica database seems to be showing old data.
  • ✓When replication may have stopped and you need the error explained.
  • ✓When you want to check how far behind a replica is.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/major/MySQLTuner-perl/blob/master/.agent/skills/diagnose-replication-lag/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Check whether my MySQL replica is behind the main server and tell me if any replication thread has failed.”

5 new skills a week. 1 minute to read.

How it works

The agent reads the replica's status with read-only commands, checks that the replication threads are running, measures the delay, and reports the exact error when a thread has failed.

Technical content (original SKILL.md)

Original text by the author, straight from 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.
FAQ

Does this skill change the replica?

No. It only reads the status and does not change anything.

What does lag mean here?

It is how many seconds the replica is behind the main server, compared with a limit you set.

Does it work with multiple sources?

Yes. It can check a specific replication channel when you name one.

Details

Original description by the author

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

repo: major/MySQLTuner-perl

Popularity

GitHub stars
9.5k
Ranking position
#12279
License
GPL-3.0
Updated
10/28/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills