restore basebackup and wal
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Sep 2021 12:41:09 +0000 (14:41 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Sep 2021 12:41:09 +0000 (14:41 +0200)
wal-archive/restore.sh [new file with mode: 0755]

diff --git a/wal-archive/restore.sh b/wal-archive/restore.sh
new file mode 100755 (executable)
index 0000000..3370274
--- /dev/null
@@ -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'"