postgresql - Postgres restore from WAL files without having a basebackup using pg_basebackup -
i have following situation.
- have master/replica setup.
- somehow database dropped , new database same name created django. in case, wal files of previous database still there?
- i have not created backup using of previous database using tool pg_basebackup, have wal files in pg_xlog.
now, trying following: - shutdown postgres server. - use recovery.conf file in pgdata (/var/lib/postgresql/9.3/main) directory , entering following in there:
restore_command = 'cp /var/lib/postgresql/9.3/main/pg_xlog_backup_jan072016/%f %p' recovery_target_time = '2016-01-07 03:00:00'
- startup postgres server again.
what see in log file is:
postgres:~/9.3/main/pg_log$ tail -100f postgresql-2016-01-07_170256.log 2016-01-07 17:02:56 utc log: database system shut down @ 2016-01-07 17:02:55 utc 2016-01-07 17:02:56 utc log: starting point-in-time recovery 2016-01-06 00:00:00+00 cp: cannot stat ‘/var/lib/postgresql/9.3/main/pg_xlog_backup_jan072016/0000000a.history’: no such file or directory cp: cannot stat ‘/var/lib/postgresql/9.3/main/pg_xlog_backup_jan072016/0000000a00000000000000cc’: no such file or directory 2016-01-07 17:02:56 utc log: consistent recovery state reached @ 0/cc000090 2016-01-07 17:02:56 utc log: record 0 length @ 0/cc000090 2016-01-07 17:02:56 utc log: redo not required 2016-01-07 17:02:56 utc log: database system ready accept read connections cp: cannot stat ‘/var/lib/postgresql/9.3/main/pg_xlog_backup_jan072016/0000000a00000000000000cc’: no such file or directory cp: cannot stat ‘/var/lib/postgresql/9.3/main/pg_xlog_backup_jan072016/0000000b.history’: no such file or directory 2016-01-07 17:02:56 utc log: selected new timeline id: 11 cp: cannot stat ‘/var/lib/postgresql/9.3/main/pg_xlog_backup_jan072016/0000000a.history’: no such file or directory 2016-01-07 17:02:57 utc log: archive recovery complete 2016-01-07 17:02:57 utc log: autovacuum launcher started 2016-01-07 17:02:57 utc log: database system ready accept connections 2016-01-07 17:02:57 utc log: incomplete startup packet
my pg_xlog_backup_jan072016 folder has foll content.:
:~/9.3/main/pg_xlog_backup_jan072016$ ls -larth total 161m -rw------- 1 postgres postgres 257 jan 7 15:57 00000007.history -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000ca -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c9 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c8 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c7 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c6 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c5 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c4 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c3 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c2 -rw------- 1 postgres postgres 16m jan 7 15:57 0000000700000000000000c1 -rw------- 1 postgres postgres 298 jan 7 15:57 00000007000000000000005d.00000028.backup -rw------- 1 postgres postgres 214 jan 7 15:57 00000006.history -rw------- 1 postgres postgres 171 jan 7 15:57 00000005.history drwx------ 3 postgres postgres 4.0k jan 7 16:54 . drwx------ 18 postgres postgres 4.0k jan 7 17:02 .. drwx------ 2 postgres postgres 4.0k jan 7 17:08 archive_status
the thing trying figure out is:
- is possible restore wal without have backup pg_basebackup command? trying restore wal in existing postgres installation.
- why log cannot find 0000000a.history , 0000000a00000000000000cc files? folder not contain such files.
can this? thanks. sarthak
Comments
Post a Comment