PostgreSQL Replication
with Bucardo
robertus
Bucardo?
U NO BUCARDO
Bucardo
• async PostgreSQL replication system
• allow multi-master and multi-slave op
• Developed by Jon Jesen and Greg Sabino
• Free and Open Source (BSD License)
Bucardo Capabilities
• master to master
• conflict resolution
• custom code
Sync Types
• Push Delta
• Full Copy
• Swap
Bucardo Terms
• Goat : database object such as tables and
sequence
• Herd : a group of goats
• Sync : sync event. one sync, one herd
Architecture
controller
source_db destination_db
Installing (Ubuntu 14.04)
• add repo : deb http://apt.postgresql.org/pub/repos/
apt/ trusty-pgdg main
• install requirement :
• perl, dbix-safe-perl, postgresql-plperl
• get source code : https://github.com/bucardo/
bucardo/archive/5.3.1.tar.gz
Config
• ./bucardo install
• ./bucardo add all tables db=source_db
• ./bucardo add all sequences db=source_db
• ./bucardo add herd copying_herd all tables
El Replicado
• Test
• ./bucardo validate all
• Replicate
• ./bucardo add sync vidio_sync
relgroup=copying_herd
dbs=source_db:source,dest_db:target
onetimecopy=2
• ./bucardo start
Inside Bucardo
Goat
./bucardo list tables
Status
Bucardo Log
How Bucardo Replicate
INSERT/UPDATE/
DELETE
BUCARDO ADD
DELTA
BUCARDO
TRIGGER SYNC
CONTROLLER
SYNC KID
NOTIFY/
LISTEN
REPLICATION EVENT
Verdict
• No lock on slave
• Conflict resolution
• Multi Master and Multi Slave
• ————————————————-
• not for HA / Failover
• not available on windows
References
• bucardo.org
• https://www.compose.io/articles/using-
bucardo-5-3-to-migrate-a-live-postgresql-database/
• image source: getty image

PostgreSQL Replication with Bucardo