Coder Social home page Coder Social logo

pgback-zstd-s3's Introduction

pgback-zstd-s3

License: Apache-2.0 Lines Of Code

Postgres (14) s3 zstd streaming backup and restore

Features

  • Backup postgres(pgdump) to s3 with zstd compression on the fly to avoid disk space and IO

    • Can override zstd compression level and compression threads
    • Supports any s3 providers supported by minio client mc, Tested on AWS s3 and minio
    • Create one off backups
  • Keep only X backup

  • Restore latest or particular backup

  • Refer docker-compose.yaml to run in docker

  • Refer k8s-cron.yaml to run as kubernets cron

  • Refer k8s-deployment.yaml to run as kubernets deployment

Usage

SCHEDULE: cron schdeule, empty will run oneoff backup

KEEP_LAST_BACKUPS: keep specified no of last backups, required

DEBUG: enable debug mode, true or false

BACKUP_ON_START: Create backup on start, true or false

BACKUP_PREFIX: backup name prefix, empty will take dbname as prefix

PGDUMP_EXTRA_OPTS: pgdump extra flags

S3_ENDPOINT: S3 endpoint, for AWS s3 not needed, required

ZSTD_EXTRA_OPTS: zstd backup extra args except -T(n) and -(compression ratio)

ZSTD_COMPRESSION_LEVEL: zstd compression level, default 15

ZSTD_COMPRESSION_THREADS: zstd compression and decompression threads, default to no of logical cores

MC_GLOBAL_FLAGS: minio client global flags used while bakup and restore

MC_UPLOAD_FLAGS: minio client backup flags

S3_ACCESS_KEY_ID: S3 key id, required

S3_SECRET_ACCESS_KEY: S3 Secret ke, required

S3_BUCKET: S3 bucket name, required

S3_PREFIX: S3 bucket path e.g. production-db, required

POSTGRES_HOST: Postgres host, required

POSTGRES_DATABASE: Postgres DB name, required

POSTGRES_USER: Postgres user, required

POSTGRES_PASSWORD: Postgres password, required

Backup object path will be something like <S3_BUCKET>/<S3_PREFIX>/<BACKUP_PREFIX else POSTGRES_DATABASE>_

Restore

Default mode is backup

MODE: specify RESTORE or restore for run it on restore mode, default backup mode

RESTORE_PSQL_EXTRA_OPTS: Restore backup psql extra flags, default emtpy

RESTORE_VERSION: specific restore version, empty will take latest backup, required in restore mode,

  • Set MODE env as RESTORE / restore and run

Development

Testing

refer tests directory

Inspired from eeshugerman/postgres-backup-s3

pgback-zstd-s3's People

Contributors

pratikbin avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.