#be carefull this will erase bucardo database
psql -U postgres -c 'drop database if exists bucardo'
bucardo_ctl install
psql -U postgres -c 'CREATE DATABASE one'
psql -U postgres -d one -c "
CREATE TABLE customers
(
id serial NOT NULL,
nome character varying(50),
CONSTRAINT customers_pkey PRIMARY KEY (id)
)
"
psql -U postgres -c 'CREATE DATABASE two TEMPLATE one'
bucardo_ctl add db one
bucardo_ctl add table customers herd=alpha standard_conflict=source ping=false db=one
bucardo_ctl add db two
bucardo_ctl add sync replica source=alpha targetdb=two type=swap
echo "now run bucardo_ctl start as root and test the replication inserting / changing data in one.customers and two.customers"
don't forget to setup cron job
http://bucardo.org/wiki/Bucardo/Cron
On each database that is used as a master (e.g. has a bucardo_delta table):
*/15 * * * * psql -X -q -d masterhost -U bucardo -c "SELECT
bucardo_purge_delta('10 minutes'::interval)"
On the main Bucardo database:
*/30 * * * * psql -X -q -d bucardo -U bucardo -c "SELECT
bucardo_purge_q_table('5 minutes'::interval)"