explaingit

cybertec-postgresql/pg_hardstorage

Analysis updated 2026-05-18

88GoAudience · ops devopsComplexity · 4/5LicenseSetup · moderate

TLDR

A single Go binary that protects PostgreSQL databases through continuous WAL streaming and scheduled base backups, enabling point-in-time recovery to any moment without OS-level access to the database host.

Mindmap

mindmap
  root((pg_hardstorage))
    Core Concept
      Continuous WAL streaming
      Periodic base backups
      Point-in-time recovery
    Storage Backends
      Local filesystem
      S3
      Google Cloud Storage
      Azure Blob
    Security
      AES-256-GCM
      AWS KMS
      GCP KMS
      HashiCorp Vault
    Platforms
      Bare metal
      Kubernetes
      Patroni clusters
    Getting Started
      One-liner install
      Docker demo
      Interactive menu
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Set up continuous PostgreSQL backup with WAL streaming for point-in-time recovery to any moment in time

USE CASE 2

Protect a Patroni high-availability PostgreSQL cluster with gap-free WAL streaming across leader switchovers

USE CASE 3

Deploy pg_hardstorage as a backup agent alongside a CloudNativePG-managed cluster on Kubernetes

USE CASE 4

Evaluate the full backup, restore, and verify flow using the included Docker Compose stack with MinIO and Grafana

What is it built with?

GoPostgreSQLS3DockerPrometheusKubernetes

How does it compare?

cybertec-postgresql/pg_hardstoragemitchellh/go-fsawuqing/backupx
Stars889296
LanguageGoGoGo
Last pushed2018-05-08
MaintenanceDormant
Setup difficultymoderateeasyeasy
Complexity4/52/53/5
Audienceops devopsdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires a PostgreSQL replication user and an accessible storage backend, the built-in Docker demo lets you test the full backup-restore flow without an existing database.

Apache 2.0: use freely for any purpose including commercial, keep the copyright and license notices when redistributing.

In plain English

pg_hardstorage is a backup tool for PostgreSQL databases, distributed as a single static binary written in Go. It is designed to provide continuous, byte-precise protection by combining two running processes: one that streams every database change log (called a WAL, or write-ahead log) to a storage repository in real time, and a second that takes periodic full base backups to anchor the stream. Together they enable point-in-time recovery, meaning you can restore the database to any specific moment, not just the last nightly snapshot. The central idea is that WAL streaming is always on. A process holds a replication slot inside PostgreSQL and ships every byte of changes as they are written, without needing access to the database host's operating system or file system. The connection uses PostgreSQL's standard replication protocol over an ordinary network connection. This design means pg_hardstorage can protect PostgreSQL running on bare metal, VMs, Patroni high-availability clusters, and databases managed by Kubernetes operators, as long as the replication protocol is available. Fully-managed cloud databases that disable the replication protocol are not supported. Storage backends include local files, S3, Google Cloud Storage, Azure Blob, SFTP, and SCP. Encryption uses AES-256-GCM, and the tool integrates with four cloud key management services: AWS KMS, GCP KMS, Azure Key Vault, and HashiCorp Vault. Content-aware deduplication reduces repository size without relying on incremental backup chains. Getting started is designed to be fast. A one-liner install script or Homebrew handles installation. Running the demo command in Docker demonstrates the full backup and restore cycle without any existing configuration. An interactive menu mode offers numbered actions (set up, back up, restore, verify) instead of requiring you to remember every command flag. A Docker Compose stack with MinIO, Prometheus, and Grafana is also included for a fuller evaluation environment. The tool supports PostgreSQL versions 15 through 18 and is released under the Apache 2.0 license.

Copy-paste prompts

Prompt 1
Using pg_hardstorage, set up continuous WAL streaming for my PostgreSQL 17 database at 10.0.0.10. Store backups on S3 with AES-256 encryption.
Prompt 2
Walk me through the pg_hardstorage demo command. What does it set up, and how do I verify the restore succeeded?
Prompt 3
I'm running CloudNativePG on Kubernetes. How do I deploy pg_hardstorage as a sidecar backup agent alongside my PostgreSQL cluster?
Prompt 4
Configure pg_hardstorage to use AES-256-GCM encryption with AWS KMS key management. What flags and IAM permissions do I need?
Prompt 5
My pg_hardstorage wal stream process crashed and restarted. How do I verify there are no WAL gaps in the archive before attempting a restore?

Frequently asked questions

What is pg_hardstorage?

A single Go binary that protects PostgreSQL databases through continuous WAL streaming and scheduled base backups, enabling point-in-time recovery to any moment without OS-level access to the database host.

What language is pg_hardstorage written in?

Mainly Go. The stack also includes Go, PostgreSQL, S3.

What license does pg_hardstorage use?

Apache 2.0: use freely for any purpose including commercial, keep the copyright and license notices when redistributing.

How hard is pg_hardstorage to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is pg_hardstorage for?

Mainly ops devops.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub cybertec-postgresql on gitmyhub

Verify against the repo before relying on details.