documentdb_distributed

DocumentDB多节点模式的API层

概览

扩展包名版本分类许可证语言
documentdb0.114SIMMITC
ID扩展名BinLibLoadCreateTrustReloc模式
9000documentdb-
9010documentdb_core-
9020documentdb_distributed-
9030documentdb_extended_rum-
相关扩展citus documentdb_core documentdb citus mongo_fdw plproxy postgres_fdw rum pg_jsonschema jsquery

版本

类型仓库版本PG 大版本包名依赖
EXTPIGSTY0.1141817161514documentdbcitus, documentdb_core, documentdb
RPMPIGSTY0.1141817161514documentdb_$vpostgresql$v-contrib, pg_cron_$v, pgvector_$v, rum_$v, postgis36_$v
DEBPIGSTY0.1141817161514postgresql-$v-documentdbpostgresql-$v-cron, postgresql-$v-pgvector, postgresql-$v-rum, postgresql-$v-postgis-3
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el8.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el9.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el9.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el10.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el10.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
d12.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
d12.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
d13.x86_64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A
d13.aarch64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A
u22.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u22.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u24.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u24.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u26.x86_64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A
u26.aarch64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A

构建

您可以使用 pig build 命令构建 documentdb 扩展的 RPM / DEB 包:

pig build pkg documentdb         # 构建 RPM / DEB 包

安装

您可以直接安装 documentdb 扩展包的预置二进制包,首先确保 PGDGPIGSTY 仓库已经添加并启用:

pig repo add pgsql -u          # 添加仓库并更新缓存

使用 pig 或者是 apt/yum/dnf 安装扩展:

pig install documentdb;          # 当前活跃 PG 版本安装
pig ext install -y documentdb -v 18  # PG 18
pig ext install -y documentdb -v 17  # PG 17
pig ext install -y documentdb -v 16  # PG 16
pig ext install -y documentdb -v 15  # PG 15
dnf install -y documentdb_18       # PG 18
dnf install -y documentdb_17       # PG 17
dnf install -y documentdb_16       # PG 16
dnf install -y documentdb_15       # PG 15
apt install -y postgresql-18-documentdb   # PG 18
apt install -y postgresql-17-documentdb   # PG 17
apt install -y postgresql-16-documentdb   # PG 16
apt install -y postgresql-15-documentdb   # PG 15

预加载配置

shared_preload_libraries = 'citus, pg_documentdb, pg_documentdb_core';

创建扩展

CREATE EXTENSION documentdb_distributed CASCADE;  -- 依赖: citus, documentdb_core, documentdb

用法

来源:

documentdb_distributed 是 DocumentDB 的内部多节点执行层。它将公共 documentdb API 与 Citus 集成;它不是一个独立的文档 API,并不会增加单独的客户端工作流程。

先决条件和安装

所有节点需要匹配版本的 Citus、documentdb_coredocumentdbdocumentdb_distributed。官方助手会将库按预加载顺序放置;在更改后,请重启每个节点:

shared_preload_libraries = 'citus, pg_cron, pg_documentdb_core, pg_documentdb, pg_documentdb_distributed'

配置好 Citus 拓扑和基础 DocumentDB 堆栈之后,以超级用户身份安装分布式组件:

CREATE EXTENSION documentdb CASCADE;
CREATE EXTENSION documentdb_distributed;

SELECT extname, extversion
FROM pg_extension
WHERE extname IN ('citus', 'documentdb_core', 'documentdb', 'documentdb_distributed');

安装完成后可以使用正常的 DocumentDB 网关或 documentdb_api 函数。分布式的集合放置、分片拓扑、工作进程可用性以及元数据一致性必须作为集群部署的一部分进行管理。

重要边界

  • 控制文件需要 citusdocumentdb_coredocumentdb,并标记该扩展为超级用户专用且不可重定位。
  • documentdb_distributed 向现有的 DocumentDB 命令提供分布式规划和执行支持;它不是公共 API 扩展的替代品。
  • 在尝试升级扩展之前,发布版本应在协调器和工作进程之间保持同步。
  • 备份、恢复、故障转移以及滚动升级流程必须包括 Citus 元数据和 DocumentDB 数据。

上游 packaging/README.md 明确指出标准包不包含 internal/pg_documentdb_distributed 组件。在添加到配置之前,请确认该分发实际包含了此扩展。版本 0.114-0 包含了一个后端特性标志下的分片 $sample 优化修复;不应将其视为无条件行为。