postgres-wal-g

Postgres Wal G Docker Image

该镜像扩展官方PostgreSQL镜像,集成WAL-G工具及辅助脚本,支持将Postgres数据库加密备份至S3兼容存储,并提供便捷的恢复功能。

5 次收藏下载次数: 0状态:社区镜像维护者:koehn仓库类型:镜像最近更新:
下载命令
点击查看

Postgres WAL-G

This image extends the stock https://hub.docker.com/_/postgres/ and adds https://github.com/wal-g/wal-g support, along with some helpful scripts. It allows you to simply and easily create continuous, encrypted archives of Postgres databases in S3-compatible storage.

Source

The source code is available here.

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 https://github.com/wal-g/wal-g/blob/master/docs/PostgreSQL.md for details)
  • WALG_S3_PREFIX to tell WAL-G which bucket and prefix you'd like to use
  • WALG_LIBSODIUM_KEY to encrypt the files stored in S3

Configuration

In your /var/lib/postgresql/data/pgsql/postgresql.conf file, set your https://www.postgresql.org/docs/current/continuous-archiving.html. 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!

Postgres Versions

Currently I build for Postgres 17, but you can build for whatever version that wal-g supports.

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 postgres-wal-g 镜像标签

docker pull docker.xuanyuan.run/koehn/postgres-wal-g:<标签>

DockerHub 原生拉取命令

docker pull koehn/postgres-wal-g:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告