Environment:
Main Library: CentOS virtual machine (Linux 32bit)
Standby Library: CentOS virtual machine (Linux 32bit)
1. installation package
Postgresql-9.2.13-3-linux.run
Edb_slony_i_pg92.bin
2. Prepare the main and standby libraries
Main Library:
Installation directory:/OPT/POSTGRESQL/9.2/
ip=192.168.100.240
port=5433
Dbname=mdb
slony Replication User ( required to be a super User ) : Postgres
Standby Library:
Installation directory:/OPT/POSTGRESQL/9.2/
ip=192.168.100.241
port=5433
Dbname=sdb
Slony Replication User ( requires Superuser ):postgres
3. Initialize slony cluster
for the main library, create a new slony cluster: Cluster01.
to the repository, create a new cluster - Join the existing cluster Cluster01.
4. Create a node path
for the main library, build cluster01 node master node, and create a new path:
host=192.168.100.241 port=5433 dbname=sdb user=postgres password=postgres
for standby, build Cluster01 nodes slave node , create a new path:
host=192.168.100.240 port=5433 Dbname=mdb user=postgres password=postgres
5. Create a Copy collection
In the main library, new replication collection 1:
In the main library MDB and the repository SDB, create the data tables to be synchronized (must have primary key to be used for slony-i data synchronization):
CREATE TABLE lyy2 (ID int primary key, name varchar);
in the main library, under Copy collection 1, Add the table public.lyy2 that you want to copy .
6. Start Slon Deamon
On the machine where the main library is located, start its Slon deamon:
[Email protected] bin]#/slon-h Cluster01 "port=192.168.100.240 port=5433 dbname=mdb user=postgres password=postgres" &
On the machine where the standby is located, start its Slon deamon:
[Email protected] bin]#/slon-h Cluster01 "port=192.168.100.241 port=5433 dbname=sdb user=postgres password=postgres" &
Configuring the use of Slony-i in Pgadmin