软件下载吧文章资讯

分类分类

PostgreSQL中Slony-I同步复制部署教程

2024-03-08 08:50作者:下载吧

前言

本文主要介绍了关于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架构图.

PostgreSQL中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)

展开全部

相关文章

说两句网友评论
    我要跟贴
    取消