pg_waldump example master
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 12 Sep 2021 08:28:44 +0000 (10:28 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 12 Sep 2021 08:28:44 +0000 (10:28 +0200)
db.txt

diff --git a/db.txt b/db.txt
index 52a7fef..270de65 100644 (file)
--- a/db.txt
+++ b/db.txt
@@ -185,6 +185,9 @@ 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
 
+restore_command = 'gunzip < /var/lib/pgsql/10/archive/%f > %p'
+
+
 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"'
@@ -218,7 +221,17 @@ dpavlin=# SELECT pg_walfile_name(pg_current_wal_lsn());
  000000010000000000000021
 (1 row)
 
+## pg_waldump
+
+https://habr.com/en/company/postgrespro/blog/496150/
+
+dpavlin=# SELECT pg_current_wal_insert_lsn();
+ pg_current_wal_insert_lsn
+---------------------------
+ 0/25000140
+(1 row)
 
+[root@slave pg_wal]# /usr/pgsql-10/bin/pg_waldump -p /var/lib/pgsql/10/data/pg_wal/ -s 0/25000140
 
 # TODO