Extract data, transform it, and load it in parallel to S3 and Postgres
Extract JSON from a REST API, enrich it, and load it in parallel to Postgres and Amazon S3.
Automated MySQL replication lag monitoring with Kestra. Query SHOW REPLICA STATUS and alert Slack on replication thread stoppage or lag spikes.
MySQL read replicas are critical for offloading read traffic from primary database masters and serving as hot standby targets. If network latency surges, intensive long-running writes block the SQL thread, or binary log coordinates desynchronize, the replica falls behind (Seconds_Behind_Master) or stops replication entirely.
This blueprint connects to MySQL replicas via JDBC, executes SHOW REPLICA STATUS, evaluates Seconds_Behind_Master, Replica_IO_Running, and Replica_SQL_Running, and immediately alerts database administrators via Slack when replication halts or breaches latency SLAs.
periodic_replication_lag_check runs on a 5-minute schedule.check_replica_status executes SHOW REPLICA STATUS via JDBC to fetch current replication telemetry.evaluate_replication_health evaluates whether Replica_IO_Running == 'Yes', Replica_SQL_Running == 'Yes', and Seconds_Behind_Master is below threshold.alert_dba_slack dispatches an urgent diagnostic alert to Slack.log_replication_healthy records normal operation.errors block catches connection drops or query failures.Last_Error) and lag spikes.Kestra features native JDBC MySQL plugins that query replication state directly, evaluate status parameters with Pebble expressions, and route alerts seamlessly without custom daemon scripts.
REPLICATION CLIENT privileges.MYSQL_PASSWORD: Password for the MySQL monitor user.SLACK_WEBHOOK: Incoming Webhook URL for Slack alerts.database_host: MySQL replica host address.database_port: MySQL port (default: 3306).database_name: Database name.database_username: Database user name.max_seconds_behind_master_threshold: Allowed replication lag in seconds (default: 300).MYSQL_PASSWORD and SLACK_WEBHOOK secrets.