postgresql replication with bucardo

17
PostgreSQL Replication with Bucardo robertus

Upload: robertus-m-s-e-kusumaning-negoro

Post on 16-Apr-2017

657 views

Category:

Software


6 download

TRANSCRIPT

Page 1: PostgreSQL Replication with Bucardo

PostgreSQL Replication with Bucardo

robertus

Page 2: PostgreSQL Replication with Bucardo

Bucardo?U NO BUCARDO

Page 3: PostgreSQL Replication with 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)

Page 4: PostgreSQL Replication with Bucardo

Bucardo Capabilities

• master to master

• conflict resolution

• custom code

Page 5: PostgreSQL Replication with Bucardo

Sync Types

• Push Delta

• Full Copy

• Swap

Page 6: PostgreSQL Replication with Bucardo

Bucardo Terms

• Goat : database object such as tables and sequence

• Herd : a group of goats

• Sync : sync event. one sync, one herd

Page 7: PostgreSQL Replication with Bucardo

Architecture

controller

source_db destination_db

Page 8: PostgreSQL Replication with Bucardo

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

Page 9: PostgreSQL Replication with Bucardo

Config

• ./bucardo install

• ./bucardo add all tables db=source_db

• ./bucardo add all sequences db=source_db

• ./bucardo add herd copying_herd all tables

Page 10: PostgreSQL Replication with Bucardo

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

Page 11: PostgreSQL Replication with Bucardo

Inside Bucardo

Page 12: PostgreSQL Replication with Bucardo

Goat./bucardo list tables

Page 13: PostgreSQL Replication with Bucardo

Status

Page 14: PostgreSQL Replication with Bucardo

Bucardo Log

Page 15: PostgreSQL Replication with Bucardo

How Bucardo ReplicateINSERT/UPDATE/

DELETEBUCARDO ADD

DELTA

BUCARDO TRIGGER SYNC

CONTROLLER

SYNC KID

NOTIFY/LISTEN

REPLICATION EVENT

Page 16: PostgreSQL Replication with Bucardo

Verdict• No lock on slave

• Conflict resolution

• Multi Master and Multi Slave

• ————————————————-

• not for HA / Failover

• not available on windows

Page 17: PostgreSQL Replication with Bucardo

References

• bucardo.org

• https://www.compose.io/articles/using-bucardo-5-3-to-migrate-a-live-postgresql-database/

• image source: getty image