MCPcopy
hub / github.com/sorintlab/stolon

github.com/sorintlab/stolon @v0.17.0 sqlite

repository ↗ · DeepWiki ↗ · release v0.17.0 ↗
846 symbols 3,083 edges 74 files 168 documented · 20%
README

stolon - PostgreSQL cloud native High Availability

Build Status Discourse Go Report Card Downloads Latest release

Stolon Logo

stolon is a cloud native PostgreSQL manager for PostgreSQL high availability. It's cloud native because it'll let you keep an high available PostgreSQL inside your containers (kubernetes integration) but also on every other kind of infrastructure (cloud IaaS, old style infrastructures etc...)

For an introduction to stolon you can also take a look at this post

Features

  • Leverages PostgreSQL streaming replication.
  • Resilient to any kind of partitioning. While trying to keep the maximum availability, it prefers consistency over availability.
  • kubernetes integration letting you achieve postgreSQL high availability.
  • Uses a cluster store like etcd, consul or kubernetes API server as an high available data store and for leader election
  • Asynchronous (default) and synchronous replication.
  • Full cluster setup in minutes.
  • Easy cluster administration
  • Can do point in time recovery integrating with your preferred backup/restore tool.
  • Standby cluster (for multi site replication and near zero downtime migration).
  • Automatic service discovery and dynamic reconfiguration (handles postgres and stolon processes changing their addresses).
  • Can use pg_rewind for fast instance resynchronization with current master.

Architecture

Stolon is composed of 3 main components

  • keeper: it manages a PostgreSQL instance converging to the clusterview computed by the leader sentinel.
  • sentinel: it discovers and monitors keepers and proxies and computes the optimal clusterview.
  • proxy: the client's access point. It enforce connections to the right PostgreSQL master and forcibly closes connections to old masters.

For more details and requirements see Stolon Architecture and Requirements

Stolon architecture

Documentation

Documentation Index

Installation

Stolon is available in brew. It is unofficial and not supported by the project. So check the version before installing using brew.

Step to install using brew

Quick start and examples

Project Status

Stolon is under active development and used in different environments. Probably its on disk format (store hierarchy and key contents) will change in future to support new features. If a breaking change is needed it'll be documented in the release notes and an upgrade path will be provided.

Anyway it's quite easy to reset a cluster from scratch keeping the current master instance working and without losing any data.

Requirements

  • PostgreSQL 12, 11, 10 or 9 (9.4, 9.5, 9.6)
  • etcd2 >= v2.0, etcd3 >= v3.0, consul >= v0.6 or kubernetes >= 1.8 (based on the store you're going to use)

  • OS: currently stolon is tested on GNU/Linux (with reports of people using it also on Solaris, *BSD and Darwin)

build

To build stolon we usually test and support the latest two major versions of Go like in the Go release policy.

make

High availability

Stolon tries to be resilient to any partitioning problem. The cluster view is computed by the leader sentinel and is useful to avoid data loss (one example over all avoid that old dead masters coming back are elected as the new master).

There can be tons of different partitioning cases. The primary ones are covered (and in future more will be added) by various integration tests

FAQ

See here for a list of faq. If you have additional questions please ask.

Contributing to stolon

stolon is an open source project under the Apache 2.0 license, and contributions are gladly welcomed! To submit your changes please open a pull request.

Contacts

  • For general discussion about using and developing stolon, join the stolon forum
  • For bugs and feature requests file an issue

Extension points exported contracts — how you extend this code

Election (Interface)
(no doc) [5 implementers]
internal/store/store.go
ServiceDiscovery (Interface)
ServiceDiscovery helps to register service [3 implementers]
cmd/stolonctl/cmd/register/discovery.go
PGManager (Interface)
(no doc) [3 implementers]
internal/postgresql/postgresql.go
Querier (Interface)
(no doc) [2 implementers]
tests/integration/utils.go
Store (Interface)
(no doc) [4 implementers]
internal/store/store.go
ConsulAgent (Interface)
ConsulAgent interface holds all the necessary methods to interact with consul agent [2 implementers]
cmd/stolonctl/cmd/register/discovery.go
ReplQuerier (Interface)
(no doc) [2 implementers]
tests/integration/utils.go
KVStore (Interface)
(no doc) [2 implementers]
internal/store/kvbacked.go

Core symbols most depended-on inside this repo

Stop
called by 100
internal/store/store.go
Start
called by 86
tests/integration/utils.go
Uint16P
called by 79
internal/cluster/cluster.go
die
called by 72
cmd/stolonctl/cmd/stolonctl.go
BoolP
called by 63
internal/cluster/cluster.go
Close
called by 55
internal/store/kvbacked.go
RemoveAll
called by 44
internal/postgresql/postgresql.go
NewKVBackedStore
called by 39
internal/store/kvbacked.go

Shape

Method 353
Function 337
Struct 108
TypeAlias 39
Interface 9

Languages

Go100%

Modules by API surface

tests/integration/utils.go71 symbols
tests/integration/ha_test.go62 symbols
internal/postgresql/postgresql.go59 symbols
cmd/sentinel/cmd/sentinel.go56 symbols
internal/cluster/cluster.go53 symbols
cmd/keeper/cmd/keeper.go44 symbols
internal/mock/store/store.go32 symbols
internal/postgresql/utils.go27 symbols
cmd/stolonctl/cmd/internal/mock/register/discovery.go26 symbols
internal/store/kvbacked.go24 symbols
internal/cluster/v0/clusterview.go24 symbols
internal/cluster/member.go22 symbols

Dependencies from manifests, versioned

github.com/coreos/bboltv1.3.3 · 1×
github.com/coreos/etcdv3.3.18+incompatible · 1×
github.com/docker/leadershipv0.1.0 · 1×
github.com/docker/libkvv0.2.1 · 1×
github.com/evanphx/json-patchv4.5.0+incompatible · 1×
github.com/golang/mockv1.4.0 · 1×
github.com/lib/pqv1.3.0 · 1×
github.com/mattn/go-isattyv0.0.12 · 1×
github.com/mitchellh/copystructurev1.0.0 · 1×

For agents

$ claude mcp add stolon \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact