Fixing Lagging Replication Slots in Postgres

DigitalOcean managed postgres is throwing an error about lagging replication slots. Apparently, this means there is unmanaged growth of write-ahead logs. Not sure why this is happening on a managed database. Surely this is something DigitalOcean should fix.

Required Action

All clients in pg_replication_slots are active and functioning correctly. Pay attention to write_lag and pg_stat_replication.

Log into database using this command.

psql "postgresql://your_username:your_password@cluster-do-user-1234567-0.db.ondigitalocean.com:25060/defaultdb?sslmode=require"

You may need to install psql

apt install libpq-dev
apt install postgresql-client