在pgadmin中配置使用slony-I

环境:

主库:centos虚拟机(linux 32bit)node

备库:centos虚拟机(linux 32bit)linux


1.安装包

postgresql-9.2.13-3-linux.runsql

edb_slony_i_pg92.binshell

 

2.准备主库和备库

主库: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


 


3.初始化slony cluster

对主库,新建slony集群:cluster01.

 对备库,新建集群-加入到已存在的集群cluster01.

 


4.建立节点路径

对主库,建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


5.建立复制集合

在主库,新建复制集合1:


在主库mdb和备库sdb,建立要同步的数据表(必须有主键才能用于slony-i的数据同步):

create table lyy2(id int primary key, name varchar);


在主库,复制集合1下面添加要复制的表public.lyy2.


6.启动slon deamon

在主库所在的机器,启动其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"&
相关文章
相关标签/搜索