轻松设置逻辑复制和切换到新数据库,停机时间最少
pg_easy_replicate 是一个 CLI 编排工具,可简化在两个 PostgreSQL 数据库之间设置 逻辑复制 的过程。pg_easy_replicate 还支持切换。在源(主数据库)完全复制后,pg_easy_replicate 将其置于只读模式,并通过逻辑复制将所有数据刷新到新的目标数据库。这样可确保零数据丢失和最小的应用程序停机时间。这种方法可用于执行最小的停机时间(最多 [-l
[ { "id": 1, "group_name": "cluster-1", "event_type": "ddl_command_end", "object_type": "table", "object_identity": "public.pgbench_accounts", "ddl_command": "ALTER TABLE public.pgbench_accounts ADD COLUMN test_column VARCHAR(255)", "created_at": "2024-08-31 15:42:33 UTC" } ]
#### Applying DDL Changes
`pg_easy_replicate` won't automatically apply the changes for you. To apply the tracked DDL changes to the target database:
bash $ pg_easy_replicate apply_ddl_change -g [-i]
If you specify a change ID with the `-i` option, only that specific change will be applied. If you don't specify an ID, you'll be prompted to apply all pending changes.
bash $ pg_easy_replicate apply_ddl_change -g cluster-1 将应用以下 DDL 更改: ID: 1, 类型: 表, 命令: ALTER TABLE public.pgbench_accounts ADD COLUMN test_column VARCHAR(255) ... 是否要应用所有这些更改?(y/n): y … 所有待处理的 DDL 更改均已成功应用。
### Stats
You can inspect or watch stats any time during the sync process. The stats give you an idea of when the sync started, current flush/write lag, how many tables are in `replicating`, `copying` or other stages, and more.
You can poll these stats to perform any other after the switchover is done. The stats include a `switchover_completed_at` which is updated once the switch over is complete.
bash $ pg_easy_replicate stats --group-name database-cluster-1 { "lag_stats": [ { "pid": 66, "cli
暂无开放 Issues,或尚未同步最近议题。