Skip to content

docs: add high-availability deployment guide with Patroni (EN + CN) - #348

Open
zhang1939 wants to merge 1 commit into
IvorySQL:masterfrom
zhang1939:docs/ha-patroni-guide
Open

zhang1939 wants to merge 1 commit into
IvorySQL:masterfrom
zhang1939:docs/ha-patroni-guide

Conversation

@zhang1939

Copy link
Copy Markdown

Closes #162

Adds a new "High Availability Deployment with Patroni" guide in both English and Chinese (EN/modules/ROOT/pages/master/high_availability_patroni.adoc + CN/...), plus navigation entries. It covers the three areas requested by the issue:

Contents

  • Overview: why manual streaming-replication failover is not enough, Patroni + etcd architecture, component table
  • Deployment: install Patroni/etcd, full working patroni.yml for two nodes, cluster bootstrap, verification
  • Failover: automatic failover drill, node rejoin (timeline follow and when use_pg_rewind is needed), planned switchover, and the async-vs-synchronous_mode data-durability trade-off
  • Monitoring and maintenance: patronictl command table, REST health endpoints, monitoring essentials
  • Production checklist: systemd unit, Patroni watchdog, a concrete HAProxy config using the /master health check, control-plane TLS pointers, three-node etcd
  • Troubleshooting: four real failure modes and their fixes

Everything was verified live

The whole guide was executed end-to-end on IvorySQL 5beta1 (PostgreSQL 19beta1) + Patroni 4.1.5 + etcd 3.5 (Ubuntu, two IvorySQL instances on one host). All command outputs in the doc are captured verbatim from that environment:

  • two-node cluster up: Leader running + Replica streaming, lag 0
  • write on leader → read from replica; pg_stat_replication shows streaming | async
  • Oracle-compat functions through the cluster (sys.last_day → 2024-02-29)
  • automatic failover after killing the leader's Patroni: timeline 1 → 2 in ~40 s; no committed data was lost in the drill (writes had ceased), and the doc spells out that async replication does not guarantee zero loss by itself, plus how to enable synchronous_mode when required
  • failed node restarted its Patroni and rejoined automatically as streaming

IvorySQL-specific notes included

Three gotchas documented that are easy to hit when running multiple IvorySQL instances (each verified during the test):

  1. every instance listens on two ports (port + ivorysql.port, default 1521) — both must be unique per node or startup fails with a socket-lock FATAL;
  2. Patroni 4.x requires postgresql.listen;
  3. the data directory must be 0700 before pg_basebackup joins a node.

Closes IvorySQL#162

新增基于 Patroni 的 IvorySQL 高可用集群部署指南(英文+中文),内容涵盖
issue 要求的三部分:概述(Patroni 架构与 etcd DCS)、部署步骤、监控与维护,
并包含故障转移演练、同步复制权衡(synchronous_mode)、pg_rewind 说明、
生产环境清单(systemd/watchdog/HAProxy/TLS/三节点 etcd)与常见问题排查。

全部步骤在 IvorySQL 5beta1 (PostgreSQL 19beta1) + Patroni 4.1.5 +
etcd 3.5 环境实测验证,包括:双节点流复制集群(streaming、lag=0)、
主库写入备库读取、pg_stat_replication 复制视图、Oracle 兼容函数经集群调用、
模拟主机宕机后的自动故障转移(时间线 1→2,约40秒完成切换)、故障节点
自动回归(跟随新时间线重新以 streaming 加入)。文中命令输出均为实测逐字记录。

文档同时记录了 IvorySQL 多实例同机部署的三个关键注意事项:
- ivorysql.port(Oracle 兼容端口,默认1521)与 unix_socket_directories
  必须逐节点唯一,否则触发 socket 锁冲突 FATAL;
- Patroni 4.x 要求 postgresql.listen 必填;
- 数据目录必须 0700 权限(pg_basebackup 不会收紧预建目录权限)。

Signed-off-by: zhang1939 <13942782872@163.com>
@github-actions
github-actions Bot temporarily deployed to pull request October 25, 2026 13:13 Inactive
@github-actions

Copy link
Copy Markdown

🚀 IvorySQL-Docs Preview Ready

This branch was previously deployed

1 inactive deployment
pull request — a9e7fda0 Deployed Oct 25, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant