restore basebackup and wal
[edozvola] / wal-archive / restore.sh
1 #!/bin/sh -xe
2
3 dir=test-2021-09-11
4
5 mkdir /tmp/r
6 chown postgres:postgres /tmp/r
7 chmod 700 /tmp/r
8
9 tar xvf /tmp/test-2021-09-11/base.tar.gz -C /tmp/r/
10 tar xvf /tmp/test-2021-09-11/pg_wal.tar.gz -C /tmp/r/pg_wal/
11
12 cp /var/lib/pgsql/10/recovery.conf /tmp/r/
13 vi /tmp/r/recovery.conf
14
15 cat postgresql.conf | grep -v archive_mode | grep -v archive_command > postgresql.conf.new && mv postgresql.conf.new postgresql.conf
16
17 su postgres -c '/usr/pgsql-10/bin/pg_ctl -D /tmp/r start -o "-p 5433"'
18
19 echo "STOP with: su postgres -c '/usr/pgsql-10/bin/pg_ctl -D /tmp/r stop'"