在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"&
相關文章
相關標籤/搜索