Workshop Réplication Logique
Dalibo & Contributors
wal_level
wal sender
wal receiver
logical replication worker
TRUNCATE
UPDATE
DELETE
postgresql.conf
wal_level = logical
pg_hba.conf
CREATE ROLE logrepli LOGIN REPLICATION; GRANT SELECT ON ALL TABLES IN SCHEMA public TO logrepli;
local b1 logrepli trust
trust
.pgpass
pg_dump -h serveur_origine -s -t la_table la_base | psql la_base
CREATE ROLE logrepli LOGIN REPLICATION;
createdb -p 5433 b1 pg_dump -p 5432 -s b1 | psql -p 5433 b1
CREATE PUBLICATION nom [ FOR TABLE [ ONLY ] nom_table [ * ] [, ...] | FOR ALL TABLES ] [ WITH ( parametre_publication [= valeur] [, ... ] ) ]
CREATE PUBLICATION publi_complete FOR ALL TABLES;
CREATE SUBSCRIPTION nom CONNECTION 'infos_connexion' PUBLICATION nom_publication [, ...] [ WITH ( parametre_souscription [= value] [, ... ] ) ]
copy_data
create_slot
enabled
slot_name
synchronous_commit
connect
CREATE SUBSCRIPTION subscr_complete CONNECTION 'port=5432 user=logrepli dbname=b1' PUBLICATION publi_complete;
CREATE PUBLICATION publi_partielle FOR TABLE t1,t2;
pg_publication
\dRp
pg_publication_tables
pg_subscription
\dRs
pg_stat_replication
pg_stat_subscription
pg_replication_origin_status
N’hésitez pas, c’est le moment !