2. Why
PostgreSQL + Replicator represents the easiest
and most flexible PostgreSQL replication
solution to date.
3. What features does it support?
● Master to many (Asynchronous) slaves
● Partial Sets
● Unique features
– Role replication
– Grant replication
– Large object replication
– Transaction logs, not triggers
● Failover/Promote
● Integrated, no triggers, easy DDL
4. Open Source + Supported
● BSD Licensed
● Open Community
● https://projects.commandprompt.com/public/replicator
● Supported
● Commercially from http://www.commandprompt.com
5. Get it!
● RPM:
– http://www.pgsqlrpms.org/
● Source:
● #! svn co
https://projects.commandprompt.com/public/replicator/repo
● Debian/Ubuntu
● Working on it
6. Compile it
● jd@hardy:~/repos$ cd REPLICATOR-8.3-1.8/
● jd@hardy:~/repos/REPLICATOR-8.3-1.8$ autoconf
● jd@hardy:~/repos/REPLICATOR-8.3-1.8$ ./configure
--prefix=/tmp/replicator
– checking build system type... i686-pc-linux-gnu
– checking host system type... i686-pc-linux-gnu
– checking which template to use... linux
– checking whether to build with 64-bit integer date/time support...
no
– checking whether NLS is wanted... no
– checking for default port number... 5432
– [...]
7. Install it
● jd@hardy:~/repos/REPLICATOR-8.3-1.8$ make -j2
install
– make -C doc install
– make[1]: Entering directory `/home/jd/repos/REPLICATOR-8.3-1.8/doc'
– make[1]: Nothing to be done for `install'.
– make[1]: Leaving directory `/home/jd/repos/REPLICATOR-8.3-1.8/doc'
– make -C src install
–
● [...]
8. Test it
● jd@hardy:~/repos/REPLICATOR-8.3-1.8$ cd src/test/
replication
● jd@hardy:~ PGROOT=/tmp/replicator ./test.pl | grep
-i succeeded
14. The MCP
● Master Control Process
– Manages replication between nodes
● Transactions
● Promotion
● Status
– Has queueing mechanism
– Unlimited (in theory) slaves without impact on
master
– Operates on any server
17. Fire up
● Start the mcp
– mcp_server -D /data/mcp_data
● Start Replication on relation
– Make sure you have a primary key
– ALTER TABLE foo ENABLE REPLICATION
– ALTER TABLE foo ENABLE REPLICATION ON SLAVE 0;
● Replicate the whole database
– SELECT enable_replication_global('{0}')
18. Check the status
type brecno frecno vrecno lrecno sync connected timestamp
master 888 888 0 497519 sync true Sat Jan 31 08:41:35
slave 0 - 497520 497519 - sync true Sat Jan 31 08:41:35
slave 1 - 888 0 - desync false Wed Dec 31 16:00:00
slave 2 - 888 0 - desync false Wed Dec 31 16:00:00
slave 3 - 888 0 - desync false Wed Dec 31 16:00:00
slave 4 - 888 0 - desync false Wed Dec 31 16:00:00
(In the normal output year is there too)