From: Dobrica Pavlinusic Date: Sat, 11 Sep 2021 12:41:09 +0000 (+0200) Subject: restore basebackup and wal X-Git-Url: http://git.rot13.org/?p=edozvola;a=commitdiff_plain;h=e42026c3e0a8cef04e276ed0bd1725936002e64b restore basebackup and wal --- diff --git a/wal-archive/restore.sh b/wal-archive/restore.sh new file mode 100755 index 0000000..3370274 --- /dev/null +++ b/wal-archive/restore.sh @@ -0,0 +1,19 @@ +#!/bin/sh -xe + +dir=test-2021-09-11 + +mkdir /tmp/r +chown postgres:postgres /tmp/r +chmod 700 /tmp/r + +tar xvf /tmp/test-2021-09-11/base.tar.gz -C /tmp/r/ +tar xvf /tmp/test-2021-09-11/pg_wal.tar.gz -C /tmp/r/pg_wal/ + +cp /var/lib/pgsql/10/recovery.conf /tmp/r/ +vi /tmp/r/recovery.conf + +cat postgresql.conf | grep -v archive_mode | grep -v archive_command > postgresql.conf.new && mv postgresql.conf.new postgresql.conf + +su postgres -c '/usr/pgsql-10/bin/pg_ctl -D /tmp/r start -o "-p 5433"' + +echo "STOP with: su postgres -c '/usr/pgsql-10/bin/pg_ctl -D /tmp/r stop'"