Code Monkey home page Code Monkey logo

postgis-wal-g's Introduction

Postgres WAL-G

This image extends the stock PostGIS Image and adds WAL-G support, along with some helpful scripts. It allows you to simply and easily create continuous archives of PostGIS databases in S3-compatible storage.

Environment

To use the image, you'll need to configure a bucket on your favorite S3- compatible provider, and set a few environment variables:

  • AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY that can read/write files to your bucket
  • AWS_ENDPOINT (et al) to tell WAL-G where to archive (see WAL-G documentation for details)
  • WALG_S3_PREFIX to tell WAL-G which bucket and prefix you'd like to use

Configuration

In your /var/lib/postgresql/data/pgsql/postgresql.conf file, set your archive settings. Importantly, you should set archive_mode = on and archive_command = 'wal-g wal-push %p'. This will tell Postgres to have WAL-G send WAL files to S3.

Full Backups

To run a full backup, simply run /wal-g/backup.sh.

Continuous Backups

These will happen automatically once you've started Postgres with your edited postgresql.conf file (see Configuration, above).

Recovery

Testing recovery is simple: run a new Docker container with the correct environment variables set and run /wal-g/recover.sh. It will:

  1. Recover from the most recent full backup
  2. Configure Postgres to not accept incoming connections or perform streaming backups until the recovery is complete (important for testing!)
  3. Configure Postgres to apply all the WAL files
  4. Shut down Postgres, re-enable incoming connections and streaming backups

At this point you should have high confidence that the recovery was successful. If you start your recovered backup, be sure to turn archive_mode = off to avoid pushing additional WAL files to S3!

PostGIS Versions

Currently I build for PostGIS 9.6 and PostGIS 11. Be advised that 9.6 is the earliest version that WAL-G supports.

postgis-wal-g's People

Contributors

koehn avatar lrwm3 avatar

Watchers

 avatar  avatar  avatar

postgis-wal-g's Issues

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.