Setting up Slony on Windows

May 13th, 2008 By: james

This isn’t intended to be a complete tutorial, but for those of us who have previously only run Slony on Linux, this might be a helpful post.

Install Slony

Configure pgAdmin file/options and set the slony path

G:\Program Files (x86)\PostgreSQL\8.2\share

Create the master db

create the slave db

Initialize the master database. From the command line
pgbench.exe -U postgres -i pb

copy the master to the slave: from command line

pg_dump.exe -U postgres -h localhost pb |psql =U postgres -h localhost pbslave

Add a new cluster on the master

add_cluster_on_master

Add a node on the slave db

Add_node_on_slave

Add a path on both the master to the slave

host=localhost port=5432 dbname=pbslave user=postgres password=a

Add_path_on_master

Add a path on the slave to the master

host=localhost port=5432 dbname=pb user=postgres password=a

add_path_on_slave

Add a replication set on the master

add_replication_set

 

Add accounts, branches, tellers

add_accounts

From the master Subscribe the slave

from the all tables set, right click subscribe set

 

 

Slony is configured, now we have to make windows start the engines correctly.

 

Create two text files in c:\slony

master.conf and slave.conf which look like this:

cluster_name='pgbench'
conn_info='dbname=pgbench user=postgres password=a'

From the command line register the engines

slon -addengine slony g:\slony\slave.conf
lon -addengine slony g:\slony\master.conf

if this hasn’t been done register slony as a service

slon -regservice slony

go to services and start slony

check event log for errors

if there are none then run a test from the master:

insert into accounts values (100001, 1, 0, 'test');

from the slave

select count(*) from accounts;

One Response to “Setting up Slony on Windows”

  1. Andrea Greggio Says:

    Images of this post are not available and i really need them..can you fix them?
    Thanks in advance,
    Greggio Andrea.

Leave a Reply