跳转到主要内容

pgactive

PostgreSQL多主逻辑复制

pgactive · PostgreSQL多主逻辑复制

概览

ID扩展软件包版本类别许可证编程语言
9560pgactivepgactive2.1.10ETLApache-2.0C
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--sLd--是是是是否否
SQL 2.1.8.

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY2.1.1019 18 17 16 15pgactive-
RPMPIGSTY2.1.1019 18 17 16 15pgactive_$v-
DEBPIGSTY2.1.1019 18 17 16 15postgresql-$v-pgactive-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
el8.aarch64N/APIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
el9.x86_64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
el9.aarch64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
el10.x86_64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
el10.aarch64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
d12.x86_64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
d12.aarch64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
d13.x86_64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
d13.aarch64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
u22.x86_64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
u22.aarch64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
u24.x86_64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
u24.aarch64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
u26.x86_64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
u26.aarch64PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10PIGSTY 2.1.10
软件包版本平台仓库大小下载
pgactive_192.1.10el9.x86_64pigsty639.5 KiBpgactive_19-2.1.10-1PGSTY.el9.x86_64.rpm
pgactive_192.1.10el9.aarch64pigsty627.5 KiBpgactive_19-2.1.10-1PGSTY.el9.aarch64.rpm
pgactive_192.1.10el10.x86_64pigsty646.4 KiBpgactive_19-2.1.10-1PGSTY.el10.x86_64.rpm
pgactive_192.1.10el10.aarch64pigsty636.4 KiBpgactive_19-2.1.10-1PGSTY.el10.aarch64.rpm
postgresql-19-pgactive2.1.10d12.x86_64pigsty597.8 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~bookworm_amd64.deb
postgresql-19-pgactive2.1.10d12.aarch64pigsty572.6 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~bookworm_arm64.deb
postgresql-19-pgactive2.1.10d13.x86_64pigsty599.0 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~trixie_amd64.deb
postgresql-19-pgactive2.1.10d13.aarch64pigsty576.4 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~trixie_arm64.deb
postgresql-19-pgactive2.1.10u22.x86_64pigsty651.8 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~jammy_amd64.deb
postgresql-19-pgactive2.1.10u22.aarch64pigsty641.2 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~jammy_arm64.deb
postgresql-19-pgactive2.1.10u24.x86_64pigsty631.8 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~noble_amd64.deb
postgresql-19-pgactive2.1.10u24.aarch64pigsty625.1 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~noble_arm64.deb
postgresql-19-pgactive2.1.10u26.x86_64pigsty628.2 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~resolute_amd64.deb
postgresql-19-pgactive2.1.10u26.aarch64pigsty619.2 KiBpostgresql-19-pgactive_2.1.10-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgactive_182.1.10el8.x86_64pigsty646.7 KiBpgactive_18-2.1.10-1PGSTY.el8.x86_64.rpm
pgactive_182.1.10el8.aarch64pigsty624.8 KiBpgactive_18-2.1.10-1PGSTY.el8.aarch64.rpm
pgactive_182.1.10el9.x86_64pigsty636.3 KiBpgactive_18-2.1.10-1PGSTY.el9.x86_64.rpm
pgactive_182.1.10el9.aarch64pigsty624.6 KiBpgactive_18-2.1.10-1PGSTY.el9.aarch64.rpm
pgactive_182.1.10el10.x86_64pigsty643.0 KiBpgactive_18-2.1.10-1PGSTY.el10.x86_64.rpm
pgactive_182.1.10el10.aarch64pigsty632.5 KiBpgactive_18-2.1.10-1PGSTY.el10.aarch64.rpm
postgresql-18-pgactive2.1.10d12.x86_64pigsty595.1 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~bookworm_amd64.deb
postgresql-18-pgactive2.1.10d12.aarch64pigsty569.0 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~bookworm_arm64.deb
postgresql-18-pgactive2.1.10d13.x86_64pigsty596.0 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~trixie_amd64.deb
postgresql-18-pgactive2.1.10d13.aarch64pigsty571.4 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~trixie_arm64.deb
postgresql-18-pgactive2.1.10u22.x86_64pigsty647.3 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~jammy_amd64.deb
postgresql-18-pgactive2.1.10u22.aarch64pigsty635.8 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~jammy_arm64.deb
postgresql-18-pgactive2.1.10u24.x86_64pigsty628.6 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~noble_amd64.deb
postgresql-18-pgactive2.1.10u24.aarch64pigsty621.7 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~noble_arm64.deb
postgresql-18-pgactive2.1.10u26.x86_64pigsty624.6 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~resolute_amd64.deb
postgresql-18-pgactive2.1.10u26.aarch64pigsty616.1 KiBpostgresql-18-pgactive_2.1.10-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgactive_172.1.10el8.x86_64pigsty637.9 KiBpgactive_17-2.1.10-1PGSTY.el8.x86_64.rpm
pgactive_172.1.10el8.aarch64pigsty617.0 KiBpgactive_17-2.1.10-1PGSTY.el8.aarch64.rpm
pgactive_172.1.10el9.x86_64pigsty628.2 KiBpgactive_17-2.1.10-1PGSTY.el9.x86_64.rpm
pgactive_172.1.10el9.aarch64pigsty616.9 KiBpgactive_17-2.1.10-1PGSTY.el9.aarch64.rpm
pgactive_172.1.10el10.x86_64pigsty633.9 KiBpgactive_17-2.1.10-1PGSTY.el10.x86_64.rpm
pgactive_172.1.10el10.aarch64pigsty624.5 KiBpgactive_17-2.1.10-1PGSTY.el10.aarch64.rpm
postgresql-17-pgactive2.1.10d12.x86_64pigsty587.9 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~bookworm_amd64.deb
postgresql-17-pgactive2.1.10d12.aarch64pigsty561.9 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~bookworm_arm64.deb
postgresql-17-pgactive2.1.10d13.x86_64pigsty589.2 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~trixie_amd64.deb
postgresql-17-pgactive2.1.10d13.aarch64pigsty564.0 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~trixie_arm64.deb
postgresql-17-pgactive2.1.10u22.x86_64pigsty714.6 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~jammy_amd64.deb
postgresql-17-pgactive2.1.10u22.aarch64pigsty704.8 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~jammy_arm64.deb
postgresql-17-pgactive2.1.10u24.x86_64pigsty620.2 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~noble_amd64.deb
postgresql-17-pgactive2.1.10u24.aarch64pigsty614.0 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~noble_arm64.deb
postgresql-17-pgactive2.1.10u26.x86_64pigsty616.6 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~resolute_amd64.deb
postgresql-17-pgactive2.1.10u26.aarch64pigsty608.6 KiBpostgresql-17-pgactive_2.1.10-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgactive_162.1.10el8.x86_64pigsty632.1 KiBpgactive_16-2.1.10-1PGSTY.el8.x86_64.rpm
pgactive_162.1.10el8.aarch64pigsty611.2 KiBpgactive_16-2.1.10-1PGSTY.el8.aarch64.rpm
pgactive_162.1.10el9.x86_64pigsty623.0 KiBpgactive_16-2.1.10-1PGSTY.el9.x86_64.rpm
pgactive_162.1.10el9.aarch64pigsty611.4 KiBpgactive_16-2.1.10-1PGSTY.el9.aarch64.rpm
pgactive_162.1.10el10.x86_64pigsty629.3 KiBpgactive_16-2.1.10-1PGSTY.el10.x86_64.rpm
pgactive_162.1.10el10.aarch64pigsty619.6 KiBpgactive_16-2.1.10-1PGSTY.el10.aarch64.rpm
postgresql-16-pgactive2.1.10d12.x86_64pigsty583.2 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~bookworm_amd64.deb
postgresql-16-pgactive2.1.10d12.aarch64pigsty557.9 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~bookworm_arm64.deb
postgresql-16-pgactive2.1.10d13.x86_64pigsty585.0 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~trixie_amd64.deb
postgresql-16-pgactive2.1.10d13.aarch64pigsty559.4 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~trixie_arm64.deb
postgresql-16-pgactive2.1.10u22.x86_64pigsty703.1 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~jammy_amd64.deb
postgresql-16-pgactive2.1.10u22.aarch64pigsty693.8 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~jammy_arm64.deb
postgresql-16-pgactive2.1.10u24.x86_64pigsty615.6 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~noble_amd64.deb
postgresql-16-pgactive2.1.10u24.aarch64pigsty608.8 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~noble_arm64.deb
postgresql-16-pgactive2.1.10u26.x86_64pigsty612.7 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~resolute_amd64.deb
postgresql-16-pgactive2.1.10u26.aarch64pigsty603.9 KiBpostgresql-16-pgactive_2.1.10-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pgactive_152.1.10el8.x86_64pigsty623.3 KiBpgactive_15-2.1.10-1PGSTY.el8.x86_64.rpm
pgactive_152.1.10el8.aarch64pigsty601.7 KiBpgactive_15-2.1.10-1PGSTY.el8.aarch64.rpm
pgactive_152.1.10el9.x86_64pigsty617.7 KiBpgactive_15-2.1.10-1PGSTY.el9.x86_64.rpm
pgactive_152.1.10el9.aarch64pigsty607.0 KiBpgactive_15-2.1.10-1PGSTY.el9.aarch64.rpm
pgactive_152.1.10el10.x86_64pigsty623.2 KiBpgactive_15-2.1.10-1PGSTY.el10.x86_64.rpm
pgactive_152.1.10el10.aarch64pigsty613.5 KiBpgactive_15-2.1.10-1PGSTY.el10.aarch64.rpm
postgresql-15-pgactive2.1.10d12.x86_64pigsty577.1 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~bookworm_amd64.deb
postgresql-15-pgactive2.1.10d12.aarch64pigsty550.5 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~bookworm_arm64.deb
postgresql-15-pgactive2.1.10d13.x86_64pigsty578.8 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~trixie_amd64.deb
postgresql-15-pgactive2.1.10d13.aarch64pigsty553.5 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~trixie_arm64.deb
postgresql-15-pgactive2.1.10u22.x86_64pigsty697.9 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~jammy_amd64.deb
postgresql-15-pgactive2.1.10u22.aarch64pigsty689.2 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~jammy_arm64.deb
postgresql-15-pgactive2.1.10u24.x86_64pigsty609.8 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~noble_amd64.deb
postgresql-15-pgactive2.1.10u24.aarch64pigsty604.2 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~noble_arm64.deb
postgresql-15-pgactive2.1.10u26.x86_64pigsty607.3 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~resolute_amd64.deb
postgresql-15-pgactive2.1.10u26.aarch64pigsty599.0 KiBpostgresql-15-pgactive_2.1.10-1PGSTY~resolute_arm64.deb

源码

pig build pkg pgactive;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install pgactive;		# install by package name

pig install pgactive -v 19;   # install for PG 19
pig install pgactive -v 18;   # install for PG 18
pig install pgactive -v 17;   # install for PG 17
pig install pgactive -v 16;   # install for PG 16
pig install pgactive -v 15;   # install for PG 15

将扩展加入 shared_preload_libraries,详见配置说明。

shared_preload_libraries = 'pgactive';

在数据库中创建扩展。

CREATE EXTENSION pgactive;

用法

来源:

pgactive 2.1.10 在数据库之间以全互联拓扑提供多主逻辑复制。写入先本地提交再复制到其他节点;应用必须处理延迟、冲突和节点本地锁,不能假定具备全局可串行化能力。

配置复制组

此版本要求 PostgreSQL 18.7、17.12、16.16、15.20 或 14.25,以及对应分支的更新次版本;发布说明还列出即将到来的 PostgreSQL 19。预加载库,配置逻辑 WAL 和足够的复制槽及工作进程,再重启。安装和管理函数需要超级用户权限。

shared_preload_libraries = 'pgactive'
wal_level = logical
CREATE EXTENSION pgactive;
SELECT pgactive.pgactive_create_group(
  node_name := 'node1-app',
  node_dsn := 'user_mapping=postgres pgactive_foreign_server=node1'
);
SELECT pgactive.pgactive_wait_for_node_ready();

示例假定已经存在使用 pgactive_fdw 的 node1 外部服务器、受保护的用户映射,以及连接自身数据库和所有其他节点的通路。实际凭据应通过受保护的映射或密码文件配置。对新加入的空数据库,先创建扩展,再用自身 node_dsn 和对端 join_using_dsn 调用 pgactive.pgactive_join_group,并等待就绪。内置加入流程负责协调初始化,独立制作的普通转储不能替代它。

运维与升级

加入节点时所有对端都必须可达。提前规划唯一键、序列分配、冲突处理和复制槽保留。DDL 复制默认关闭,启用时要求发送端和接收端采用一致策略。应用工作进程默认以表所有者身份执行 DML,但复制连接及工作进程管理仍具备高权限。

2.1.10 加固复制名称和元组处理,并修复冲突处理器 ABI 与共享内存锁偏移。2.1.10 节点可以加入旧版本组,但 2.1.9 及更早节点必须先升级,才能加入 2.1.10 节点。安装匹配文件,在每个数据库执行随附 SQL 升级,并协调组内的重启、重连和加入顺序。

表格阅读器