Slony-I 2.1.1 Documentation I
Total Page:16
File Type:pdf, Size:1020Kb
Slony-I 2.1.1 Documentation i Slony-I 2.1.1 Documentation Slony-I 2.1.1 Documentation ii Copyright © 2004-2010 The PostgreSQL Global Development Group Legal Notice Slony-I is Copyright © 2004-2010 by the PostgreSQL Global Development Group and is distributed under the terms of the license of the University of California below. Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIM- ITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN ‘AS-IS’ BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. Note that UNIX™ is a registered trademark of The Open Group. Windows™ is a registered trademark of Microsoft Corporation in the United States and other countries. Solaris™ is a registered trademark of Sun Microsystems, Inc. Linux™ is a trademark of Linus Torvalds. AIX™ is a registered trademark of IBM. Slony-I 2.1.1 Documentation iii COLLABORATORS TITLE : Slony-I 2.1.1 Documentation ACTION NAME DATE SIGNATURE WRITTEN BY Christopher Browne February 2, 2012 REVISION HISTORY NUMBER DATE DESCRIPTION NAME Slony-I 2.1.1 Documentation iv Contents 1 Preface 1 1.1 Introduction to Slony-I . .1 1.1.1 What Is Slony-I . .1 1.1.2 About This Book . .1 1.2 System Requirements . .1 1.2.1 Requirements for compiling Slony-I . .2 1.2.2 Getting Slony-I Source . .2 1.3 Slony-I Concepts . .2 1.3.1 Cluster . .3 1.3.2 Node . .3 1.3.3 Replication Set . .3 1.3.4 Origin, Providers and Subscribers . .3 1.3.5 slon Daemon . .4 1.3.6 slonik Configuration Processor . .4 1.3.7 Slony-I Path Communications . .4 1.3.8 SSH tunnelling . .5 1.4 Current Limitations . .6 2 Tutorial 7 2.1 Replicating Your First Database . .7 2.1.1 Creating the pgbench User . .8 2.1.2 Preparing the Databases . .8 2.1.3 Configuring the Database For Replication. .9 2.1.3.1 Using slonik Command Directly . .9 2.1.3.2 Using the altperl Scripts . 11 2.2 Starting & Stopping Replication . 12 2.2.1 Deploying Slon Processes . 12 2.2.2 Starting Slon On Unix Systems . 12 2.2.2.1 Invoking slon Directly . 12 2.2.2.2 start_slon.sh . 13 2.2.3 Stopping Slon On a Unix System . 13 2.2.4 Starting Slon On a MS-Windows System . 13 2.2.5 Stopping slon On MS-Windows . 13 Slony-I 2.1.1 Documentation v 3 Administration Tasks 14 3.1 Slony-I Building & Installation . 14 3.1.1 Short Version . 14 3.1.2 Configuration . 14 3.1.3 Example . 17 3.1.4 Build . 17 3.1.5 Installing Slony-I Once Built; . 17 3.1.6 Building on Win32 . 18 3.1.7 Building Documentation: Admin Guide . 18 3.1.8 Installing Slony-I from RPMs . 19 3.1.9 Installing the Slony-I service on Windows™ . 19 3.2 Modifying Things in a Replication Cluster . 19 3.2.1 Adding a Table To Replication . 19 3.2.2 How To Add Columns To a Replicated Table . 20 3.2.3 How to remove replication for a node . 20 3.2.4 Adding a Replication Node . 21 3.2.5 Adding a Cascaded Replica . 22 3.2.6 How do I use Log Shipping? . 22 3.2.7 How To Remove Replication For a Node . 22 3.2.8 Changing a Nodes Provider . 22 3.2.9 Moving The Master From One Node To Another . 23 3.3 Database Schema Changes (DDL) . 23 3.3.1 DDL Changes with Execute Script . 23 3.3.2 Applying DDL Changes Directly . 24 3.4 Doing switchover and failover with Slony-I . 24 3.4.1 Foreword . 24 3.4.2 Controlled Switchover . 25 3.4.3 Failover . 25 3.4.4 Failover With Complex Node Set . 26 3.4.5 Automating FAIL OVER ......................................... 28 3.4.6 After Failover, Reconfiguring Former Origin . 28 3.4.7 Planning for Failover . 29 4 Advanced Concepts 30 4.1 Events & Confirmations . 30 4.1.1 SYNC Events . 30 4.1.2 Event Confirmations . 30 4.1.3 Event cleanup . 30 4.1.4 Slonik and Event Confirmations . 31 Slony-I 2.1.1 Documentation vi 4.2 Slony-I Listen Paths . 31 4.2.1 How Listening Can Break . 32 4.2.2 How the Listen Configuration Should Look . 32 4.2.3 Automated Listen Path Generation . 33 4.3 Slony-I Trigger Handling . ..