Setting up Slony
While there are a few logical asynchronous replication systems for PostgreSQL, Slony-I (Slony in short) was the first to gain wide adoption. Why would we use Slony when PostgreSQL already has replication? Currently, PostgreSQL replication can only copy the entire installation. Every database, schema, table, and user is copied at the binary level. In effect, streaming replication creates perfect clones of PostgreSQL servers.
Slony is very different. It is designed to copy tables only, capturing changes on a master server and sending them to one or more subscribers. If you want this type of replication, this section will provide a basic installation recipe designed for one master and one subscriber.
Getting ready
In order to install Slony, we will need the source code. At the time of writing this book, the latest version available is 2.2.2. You can obtain a copy of the source at http://slony.info/downloads/2.2/source/.
We only need the primary source package, but feel free to...