标签:
主库:centos虚拟机(linux 32bit)
备库:centos虚拟机(linux 32bit)
postgresql-9.2.13-3-linux.run
edb_slony_i_pg92.bin
主库:
安装目录:/opt/PostgreSQL/9.2/
ip=192.168.100.240
port=5433
dbname=mdb
Slony replication用户(要求是超级用户):postgres
备库:
安装目录:/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"&
标签:
原文地址:http://my.oschina.net/liuyuanyuangogo/blog/507936