時間:2024-03-08 08:50作者:下載吧人氣:22
前言
本文主要介紹了關于PostgreSQL中Slony-I同步復制部署的相關內容,分享出來供大家參考學習,下面話不多說了,來一起看看詳細的介紹吧
本次測試環境
IP | 10.189.102.118 | 10.189.100.195 | 10.189.100.226 |
PGHOME | /usr/local/pgsql | /usr/local/pgsql | /usr/local/pgsql |
Role | Origin,Providers | Subscribers,Providers | Subscribers |
Database | region_il | region_il | region_il |
Table |
il_longlive.entity il_longlive.entity_result il_longlive.result il_longlive.result_logbook |
il_longlive.entity il_longlive.entity_result il_longlive.result il_longlive.result_logbook |
il_longlive.entity il_longlive.entity_result il_longlive.result il_longlive.result_logbook |
Sequences |
il_longlive.entity_entity_id_seq il_longlive.entity_result_id_seq il_longlive.result_id_seq il_longlive.result_logbook_record_id_seq |
il_longlive.entity_entity_id_seq il_longlive.entity_result_id_seq il_longlive.result_id_seq il_longlive.result_logbook_record_id_seq |
il_longlive.entity_entity_id_seq il_longlive.entity_result_id_seq il_longlive.result_id_seq il_longlive.result_logbook_record_id_seq |
Slony-I一般要求表有主鍵,或者唯一鍵,Slony-I會自動識別主鍵,如果表沒有主鍵,需要手工指定唯一鍵,如果沒有指定唯一鍵,則不能復制,下圖為Slony-I架構圖.
1. 查看主庫表信息
region_il=# d
List of relations
Schema | Name | Type | Owner
————-+——————————+———-+———-
il_longlive | entity | table | postgres
il_longlive | entity_entity_id_seq | sequence | postgres
il_longlive | entity_result | table | postgres
il_longlive | entity_result_id_seq | sequence | postgres
il_longlive | result | table | postgres
il_longlive | result_id_seq | sequence | postgres
il_longlive | result_logbook | table | postgres
il_longlive | result_logbook_record_id_seq | sequence | postgres
il_longlive | result_vendor_schema | table | postgres
il_longlive | result_vendor_schema_id_seq | sequence | postgres
il_longlive | snapshot | table | postgres
il_longlive | snapshot_id_seq | sequence | postgres
(12 rows)
region_il=# d entity
Table “il_longlive.entity”
Column | Type | Modifiers
————–+————————+————————————————————
entity_id | integer | not null default nextval(‘entity_entity_id_seq’::regclass)
country_code | character varying(3) |
state_code | character varying(50) |
name | character varying(128) |
islive | boolean |
Indexes:
“entity_pkey” PRIMARY KEY, btree (entity_id)
region_il=# select count(*) from entity;
count
———
(1 row)
網友評論