postgre 开启cdc
Last updated on November 25, 2025 am
🧙 Questions
开启postgre的cdc
☄️ Ideas
docker中一定要安装
docker exec -it isxcode-postgre bash
sed -i 's/http:\/\/deb.debian.org/http:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list
sed -i 's/http:\/\/security.debian.org/http:\/\/mirrors.aliyun.com/g' /etc/apt/sources.list
apt-get update
# apt-cache search postgresql | grep decoderbufs
# select version()
# apt-get install -y postgresql-${version}-decoderbufs
apt-get install -y postgresql-14-decoderbufs
# psql -h hostname -p port -U username -d databasename
# psql -h localhost -p 5432 -U root -d isxcode_dbALTER SYSTEM SET wal_level = 'logical';
ALTER SYSTEM SET max_replication_slots = 15;
ALTER SYSTEM SET max_wal_senders = 15;
-- 指定一张表,来源表一定要给FULL,否则不能更新
ALTER TABLE public.cdc_source REPLICA IDENTITY FULL# 只有重启才能生效
docker restart isxcode-postgre-- replica 默认值,不归档
SHOW wal_level;
-- slot个数
SHOW max_replication_slots;
show max_wal_senders;🔗 Links
postgre 开启cdc
https://ispong.isxcode.com/db/postgre/postgre 开启cdc/