Difference between revisions of "Freeside:2.1:Documentation:Administration:Slony"

From Freeside
Jump to: navigation, search
(Prerequisites)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Prerequisites =
 
= Prerequisites =
  
You need to have slony setup and working on both machines.  These instructions are meant to be used in conjuction with the [http://main.slony.info/documentation/ Slony documentation].
+
You need to have slony setup and working on both machines (on Debian: <code>aptitude install postgresql-8.4-slony1-2 slony1-2-bin</code>).  These instructions are meant to be used in conjuction with the [http://main.slony.info/documentation/2.0/ Slony documentation].
  
 
You need to have Freeside setup and working on both machines.  On the slave machine, don't run freeside-setup or start the daemons, but *do* put the init script in place and setup any necessary SSH keys or database auth necessary for integration.  Copy <code>conf.''datasrc''</code>, <code>dbdef.''datasrc''</code> and <code>htpasswd</code> from the master to the slave server.
 
You need to have Freeside setup and working on both machines.  On the slave machine, don't run freeside-setup or start the daemons, but *do* put the init script in place and setup any necessary SSH keys or database auth necessary for integration.  Copy <code>conf.''datasrc''</code>, <code>dbdef.''datasrc''</code> and <code>htpasswd</code> from the master to the slave server.
Line 7: Line 7:
 
= Setup =
 
= Setup =
  
* See the Slony documentation on [http://main.slony.info/documentation/2.0/firstdb.html Replicating Your First Database]
+
* See the Slony documentation on [http://main.slony.info/documentation/2.0/tutorial.html#FIRSTDB Replicating Your First Database]
  
 
* Run <code>bin/slony-setup ''username'' | more</code> and follow the generated instructions.
 
* Run <code>bin/slony-setup ''username'' | more</code> and follow the generated instructions.

Latest revision as of 01:34, 25 January 2012

Prerequisites

You need to have slony setup and working on both machines (on Debian: aptitude install postgresql-8.4-slony1-2 slony1-2-bin). These instructions are meant to be used in conjuction with the Slony documentation.

You need to have Freeside setup and working on both machines. On the slave machine, don't run freeside-setup or start the daemons, but *do* put the init script in place and setup any necessary SSH keys or database auth necessary for integration. Copy conf.datasrc, dbdef.datasrc and htpasswd from the master to the slave server.

Setup

  • Run bin/slony-setup username | more and follow the generated instructions.

Failover

  • Determine if you are doing a controlled switchover or a failover.
  • A controlled switchover is preferable. On the master server, run:
slonik <<END
lock set (id = 1, origin = 1);
wait for event (origin = 1, confirmed = 2);
move set (id = 1, old origin = 1, new origin = 2);
wait for event (origin = 1, confirmed = 2);
END
  • A failover may be necessary. IMPORTANT: "shoot the master server in the head" - make sure it is powered off / disconnected from the network. On the slave server, run:
slonik <<END
failover (id = 1, backup node = 2);
drop node (id = 1, event node = 2);
END
  • Start the freeside daemons on the slave server:
/etc/init.d/freeside start