I have two DB servers and backup which is configured by pg_basebackup. You can see whole command below.
pg_basebackup -h $PGHOST -p $PGPORT -U $PGUSER -w -D $backup_dir/psql_base_backup_$(date +"%d-%m-%y") -l "$(date)" -F tar -z -R -P &>> $backup_dir/status.log
Below you can see my prod DB which I want to backup:
postgres=# \c sks-api
You are now connected to database "sks-api" as user "postgres".
sks-api=# \dt
List of relations
Schema | Name | Type | Owner
--------+------------------+-------+-------
public | clusters | table | api
public | migrations | table | api
public | nodepools | table | api
public | service_instance | table | api
public | tasks | table | api
public | update_schedule | table | api
public | version_registry | table | api
(7 rows)
sks-api=# SHOW data_directory;
data_directory
--------------------------------
/var/lib/postgresql/13/cluster
(1 row)
Now I am trying to restore this DB for test purposes. I create the same two servers and doing below things:
systemctl stop postgresql
cd /home/user
tar -xzf base.tar.gz -C /var/lib/postgresql/13/cluster
tar -xzf pg_wal.tar.gz -C /var/lib/postgresql/13/cluster
systemctl start postgresql
But after that I see only two tables in sks-api db. What I did wrong?
sks-api=# \dt
List of relations
Schema | Name | Type | Owner
--------+------------+-------+---------------------
public | migrations | table | unknown (OID=16386)
public | nodepools | table | unknown (OID=16386)
(2 rows)