主庫:centos虛擬機(linux 32bit)node
備庫:centos虛擬機(linux 32bit)linux
postgresql-9.2.13-3-linux.runsql
edb_slony_i_pg92.binshell
主庫:centos
安裝目錄:/opt/PostgreSQL/9.2/post
ip=192.168.100.240spa
port=5433postgresql
dbname=mdbcode
Slony replication用戶(要求是超級用戶):postgresip
備庫:
安裝目錄:/opt/PostgreSQL/9.2/
Ip=192.168.100.241
Port=5433
dbname=sdb
Slony replication用戶(要求是超級用戶):postgres
對主庫,新建slony集羣:cluster01.
對備庫,新建集羣-加入到已存在的集羣cluster01.
對主庫,建cluster01的節點master node,新建path:
host=192.168.100.241 port=5433 dbname=sdb user=postgres password=postgres
對備庫,建cluster01的節點slave node,新建path:
host=192.168.100.240 port=5433 dbname=mdb user=postgres password=postgres
在主庫,新建複製集合1:
在主庫mdb和備庫sdb,建立要同步的數據表(必須有主鍵才能用於slony-i的數據同步):
create table lyy2(id int primary key, name varchar);
在主庫,複製集合1下面添加要複製的表public.lyy2.
在主庫所在的機器,啓動其slon deamon:
[root@localhost bin]# ./slon -h cluster01 "port=192.168.100.240 port=5433 dbname=mdb user=postgres password=postgres"&
在備庫所在的機器,啓動其slon deamon:
[root@localhost bin]# ./slon -h cluster01 "port=192.168.100.241 port=5433 dbname=sdb user=postgres password=postgres"&