PostgreSQL streaming replication - setup, monitoring, failover
Sets up PostgreSQL streaming replication between primary and replica nodes, monitors replication lag, and performs failover operations. Used when configuring high-availability databases or managing replica health.
/plugin marketplace add pluginagentmarketplace/custom-plugin-postgresql/plugin install ultrathink@pluginagentmarketplace-postgresqlThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/replication-config.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyAtomic skill for streaming replication
Production-ready patterns for streaming replication, monitoring, and failover with Patroni.
parameters:
operation:
type: string
required: true
enum: [setup_primary, setup_replica, monitor, failover]
replication_mode:
type: string
enum: [async, sync]
default: async
-- postgresql.conf
wal_level = replica
max_wal_senders = 10
max_replication_slots = 10
-- Create replication user
CREATE ROLE replicator WITH REPLICATION LOGIN PASSWORD 'secret';
-- Create slot
SELECT pg_create_physical_replication_slot('replica1');
pg_basebackup -h primary -D /data -U replicator -v -P -R
-- On primary
SELECT client_addr, state,
pg_size_pretty(pg_wal_lsn_diff(sent_lsn, replay_lsn)) as lag
FROM pg_stat_replication;
-- On replica
SELECT pg_is_in_recovery(), pg_last_wal_replay_lsn();
scope: cluster
bootstrap:
dcs:
ttl: 30
maximum_lag_on_failover: 1048576
| Mode | Data Safety | Latency |
|---|---|---|
| async | Possible loss | Low |
| sync | No loss | Higher |
| Problem | Cause | Solution |
|---|---|---|
| Lag increasing | Slow replica | Check I/O |
| Slot inactive | Replica down | Drop old slot |
| Failover failed | etcd issue | Check cluster |
Skill("postgresql-replication")
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.