展示HN:Pgconverge – 一个基于Go的实验性多主PostgreSQL框架

2作者: sobowalebukola大约 1 个月前原帖
嗨,HN, 在过去的几个月里,我一直在构建 pgconverge,这是一个实验性的开源框架,用于操作多主 PostgreSQL 集群。 该项目最初是作为一个学习练习,旨在更好地理解分布式数据库,而不是试图替代 PostgreSQL 现有的复制模型。我的目标是探索多个 PostgreSQL 节点如何独立接受写入,同时最终在不依赖指定主数据库的情况下进行收敛。随着时间的推移,这个实验演变成了一个可用的开源框架。 我探索的一些领域包括: - 全网状复制拓扑 - 使用最后写入胜利的冲突解决 - 用于排序并发写入的混合逻辑时钟 - 将新节点引导到现有集群中 - 声明式集群配置 GitHub 链接:[https://github.com/sobowalebukola/pgconverge](https://github.com/sobowalebukola/pgconverge) 在此过程中,我记录了设计决策,形成了七部分的工程系列文章: - 为什么选择多主?单写数据库的问题 [阅读更多](https://blog.stackademic.com/why-multi-master-the-problem-with-single-writer-databases-548470efe812) - pgconverge 内部:导航 N × (N − 1) 的全网状复制复杂性 [阅读更多](https://blog.stackademic.com/inside-pgconverge-navigating-the-n-n-1-complexity-of-full-mesh-replication-ad023ab3a308) - 身份危机:pgconverge 如何使用 UUID、节点名称和分布式主键 [阅读更多](https://blog.stackademic.com/identity-crisis-how-pgconverge-uses-uuids-node-names-and-distributed-primary-keys-ad6797c2e1a7) - 最后写入胜利:pgconverge 中最简单的冲突解决及其局限性 [阅读更多](https://blog.stackademic.com/last-write-wins-the-simplest-conflict-resolution-and-its-limits-in-pgconverge-7b0f160a3b86) - 带有混合逻辑时钟的 pgconverge:当墙钟不足时 [阅读更多](https://blog.stackademic.com/pgconverge-with-hybrid-logical-clocks-when-wall-clocks-are-not-enough-907d63de5b41) - 在 pgconverge 中引导新节点:pg_basebackup 与 COPY 数据 [阅读更多](https://blog.stackademic.com/bootstrapping-new-nodes-in-pgconverge-pg-basebackup-vs-copy-data-47cc18384024) - 使用 pgconverge 操作多主 PostgreSQL 集群 [阅读更多](https://blog.stackademic.com/operating-multi-master-postgresql-clusters-with-pgconverge-96df7857a91a)
查看原文
Hi HN,<p>Over the past few months I&#x27;ve been building pgconverge, an experimental open-source framework for operating multi-master PostgreSQL clusters.<p>The project started as a learning exercise to better understand distributed databases rather than as an attempt to replace PostgreSQL&#x27;s existing replication model. My goal was to explore what it would take for multiple PostgreSQL nodes to accept writes independently while eventually converging without relying on a designated primary database. Over time, the experiment evolved into a working open-source framework.<p>Some of the areas I explored include:<p>full-mesh replication topology conflict resolution using Last-Write-Wins Hybrid Logical Clocks for ordering concurrent writes bootstrapping new nodes into an existing cluster declarative cluster configuration<p>Github Link: <a href="https:&#x2F;&#x2F;github.com&#x2F;sobowalebukola&#x2F;pgconverge" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sobowalebukola&#x2F;pgconverge</a><p>Along the way I documented the design decisions in a seven-part engineering series:<p>Why Multi-Master? The Problem with Single-Writer Databases<p><a href="https:&#x2F;&#x2F;blog.stackademic.com&#x2F;why-multi-master-the-problem-with-single-writer-databases-548470efe812" rel="nofollow">https:&#x2F;&#x2F;blog.stackademic.com&#x2F;why-multi-master-the-problem-wi...</a><p>Inside pgconverge: Navigating the N × (N − 1) Complexity of Full-Mesh Replication<p><a href="https:&#x2F;&#x2F;blog.stackademic.com&#x2F;inside-pgconverge-navigating-the-n-n-1-complexity-of-full-mesh-replication-ad023ab3a308" rel="nofollow">https:&#x2F;&#x2F;blog.stackademic.com&#x2F;inside-pgconverge-navigating-th...</a><p>Identity Crisis: How pgconverge Uses UUIDs, Node Names, and Distributed Primary Keys<p><a href="https:&#x2F;&#x2F;blog.stackademic.com&#x2F;identity-crisis-how-pgconverge-uses-uuids-node-names-and-distributed-primary-keys-ad6797c2e1a7" rel="nofollow">https:&#x2F;&#x2F;blog.stackademic.com&#x2F;identity-crisis-how-pgconverge-...</a><p>Last-Write-Wins: The Simplest Conflict Resolution and Its Limits in pgconverge<p><a href="https:&#x2F;&#x2F;blog.stackademic.com&#x2F;last-write-wins-the-simplest-conflict-resolution-and-its-limits-in-pgconverge-7b0f160a3b86" rel="nofollow">https:&#x2F;&#x2F;blog.stackademic.com&#x2F;last-write-wins-the-simplest-co...</a><p>pgconverge with Hybrid Logical Clocks: When Wall Clocks Are Not Enough<p><a href="https:&#x2F;&#x2F;blog.stackademic.com&#x2F;pgconverge-with-hybrid-logical-clocks-when-wall-clocks-are-not-enough-907d63de5b41" rel="nofollow">https:&#x2F;&#x2F;blog.stackademic.com&#x2F;pgconverge-with-hybrid-logical-...</a><p>Bootstrapping New Nodes in pgconverge: pg_basebackup vs COPY Data<p><a href="https:&#x2F;&#x2F;blog.stackademic.com&#x2F;bootstrapping-new-nodes-in-pgconverge-pg-basebackup-vs-copy-data-47cc18384024" rel="nofollow">https:&#x2F;&#x2F;blog.stackademic.com&#x2F;bootstrapping-new-nodes-in-pgco...</a><p>Operating Multi-Master PostgreSQL Clusters with pgconverge<p><a href="https:&#x2F;&#x2F;blog.stackademic.com&#x2F;operating-multi-master-postgresql-clusters-with-pgconverge-96df7857a91a" rel="nofollow">https:&#x2F;&#x2F;blog.stackademic.com&#x2F;operating-multi-master-postgres...</a>