This document should get you up and running with a replicated PostgreSQL database in just a few steps. We'll gloss over many details in the interest of getting you up and running as quickly as possible. To make things simple, this document will use the sample cluster configuration found in the "bruce/sample" directory of the distribution. The example uses a single PostgreSQL installation with 4 databases.

The master and each slave have a replication_test schema and a replication_test.replicate_this table that we will replicate across the cluster.

Note: This demonstration makes the assumption that all replicated clusters in the schema contain identical data.

Automated Test

The steps in this guide are loosely followed in test/src/com/netblue/bruce/SetupClusterFromExistingDbAcceptanceTest.java


Configure the node topology database urls:

Setup the node topology

Command line notes:

-data ../sample/config.xml tells us what data file to load. the sample file contains 1 master and 2 slaves with replication patterns to recognize the replication_test.* tables.

-initnodeschema tells us to install the replication schema on each node, along with the triggers for each replicated table. If the schema is already installed, then only the replication triggers are installed for each replicated table. For master nodes, if there is no data in the snapshotlog table (as in this case) a snapshot of the db is taken.

-initsnapshots MASTER tells us to set the slave snapshot status to the last snapshot in the master database. Since the -initnodeschema option initializes this for us, we'll use that.

-loadschema tells us to install the replication node topology schema on the configuration database. This is only really useful the first time you run the admin tool for a given configuration database.

-operation CLEAN_INSERT tells us to drop everything from the node topology configuration database before inserting these new nodes

-url is the URL for the configuration database

-pass is the password for the configuration database

Start up replication for the new cluster

Insert rows in master, confirm slave is updated