Scripts2026年5月19日·1 分钟阅读

Stolon — Cloud-Native PostgreSQL High Availability Manager

Stolon is a cloud-native PostgreSQL high-availability manager written in Go. It uses a distributed consensus store (etcd, Consul, or Kubernetes API) to coordinate automatic failover, synchronous replication, and proxy routing for PostgreSQL clusters.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Stolon Overview
通用 CLI 安装命令
npx tokrepo install 18fff472-5319-11f1-9bc6-00163e2b0d79

Introduction

Stolon provides automated high availability for PostgreSQL by coordinating sentinels, keepers, and proxies through a distributed store. It handles leader election, automatic failover, and streaming replication so PostgreSQL clusters can survive node failures without manual intervention.

What Stolon Does

  • Manages PostgreSQL high availability with automatic leader election and failover
  • Coordinates cluster state through etcd, Consul, or the Kubernetes API
  • Routes client connections to the current primary through a smart proxy component
  • Configures and maintains streaming replication between primary and standbys
  • Supports synchronous replication for zero-data-loss failover scenarios

Architecture Overview

Stolon has three components: the Sentinel monitors cluster health and decides failover actions, the Keeper manages the local PostgreSQL instance (starting, stopping, promoting, and configuring replication), and the Proxy routes client connections to the current primary. All components coordinate through a distributed key-value store, making the system resilient to network partitions and component failures.

Self-Hosting & Configuration

  • Deploy etcd, Consul, or use the Kubernetes API as the cluster store backend
  • Run at least two Sentinels for high availability of the management layer
  • Run one Keeper per PostgreSQL instance, each with its own data directory
  • Deploy Proxies on application nodes or as a service for connection routing
  • Use stolonctl to initialize the cluster and manage configuration changes

Key Features

  • Automatic failover with configurable timeout and fencing policies
  • Supports both asynchronous and synchronous streaming replication
  • Kubernetes-native deployment with Helm charts and StatefulSet patterns
  • Point-in-time recovery integration with backup tools like WAL-G and Barman
  • Declarative cluster specification managed through stolonctl update

Comparison with Similar Tools

  • Patroni — Similar HA manager with more community adoption; Stolon offers a separate proxy component for connection routing
  • CloudNativePG — Kubernetes-native operator approach; Stolon works on bare metal and VMs as well
  • pgBouncer + repmgr — Manual HA setup requiring more operational glue; Stolon automates the full stack
  • Crunchy PGO — Commercial Kubernetes operator; Stolon is fully open source under Apache 2.0
  • pg_auto_failover — Simpler architecture with a monitor node; Stolon uses distributed consensus for stronger fault tolerance

FAQ

Q: Can Stolon run outside of Kubernetes? A: Yes. Stolon supports etcd and Consul as store backends for bare-metal and VM deployments.

Q: How fast is automatic failover? A: Failover typically completes within seconds, depending on the configured health check interval and timeout.

Q: Does Stolon support read replicas for load balancing? A: The proxy routes to the primary only. Read replicas can be accessed directly for read-only workloads.

Q: Is Stolon still actively maintained? A: The project receives updates periodically and has a stable feature set suitable for production use.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产