I setup a remote server, and install barman in that server, keep it simple, just call it "barman", and I have postgres database located in another VM, call "syb-db". I have already setup everything as Document section mentions. and backup is working too.
What I try to do is to restore "postgres" instance back to a specific time. Let's have more detail here:
As 21:48:00 is an accident, I manage to restore back to the time after change to Table A.
And this database is low traffic, after drop table B, and at time around 21:49, I issue a restore command:
Since I know there's a bug, which cause rsync recovery.conf remotely failed, so I manage to create one in postgres VM, just paste the content of recovery.conf below:
And then I try to start the postgresql server.
I manage to figure out what happend, try to look up the log located in /var/log/postgresql/postgresql-9.3-main.log
{
"global": {
"config": {
"barman_home": "/var/lib/barman",
"barman_user": "barman",
"log_file": "/var/log/barman/barman.log"
},
"system_info": {
"kernel_ver": "Linux
barman.example.com 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux",
"python_ver": "Python 2.7.6",
"release": "Distributor ID:\tUbuntu\nDescription:\tUbuntu 14.04 LTS\nRelease:\t14.04\nCodename:\ttrusty",
"rsync_ver": "rsync version 3.1.0 protocol version 31",
"ssh_ver": "usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]"
}
},
"servers": {
"syb-db": {
"backups": {
"20140709T010608": {
"backup_id": "20140709T010608",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 01:06:08 2014",
"begin_wal": "000000010000000000000002",
"begin_xlog": "0/2000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": null,
"end_time": null,
"end_wal": null,
"end_xlog": null,
"error": "failure issuing stop of the backup (concurrent exclusive backups are not allowed)",
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27580585,
"status": "FAILED",
"tablespaces": null,
"timeline": 1,
"version": 90304
},
"20140709T011153": {
"backup_id": "20140709T011153",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 01:11:53 2014",
"begin_wal": "000000010000000000000005",
"begin_xlog": "0/5000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": null,
"end_time": null,
"end_wal": null,
"end_xlog": null,
"error": null,
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27580596,
"status": "STARTED",
"tablespaces": null,
"timeline": 1,
"version": 90304
},
"20140709T011343": {
"backup_id": "20140709T011343",
"backup_label": "None",
"begin_offset": null,
"begin_time": null,
"begin_wal": null,
"begin_xlog": null,
"config_file": null,
"end_offset": null,
"end_time": null,
"end_wal": null,
"end_xlog": null,
"error": "failure detecting data directory (could not connect to server: Connection refused)",
"hba_file": null,
"ident_file": null,
"mode": "default",
"pgdata": null,
"server_name": "syb-db",
"size": null,
"status": "FAILED",
"tablespaces": null,
"timeline": null,
"version": null
},
"20140709T011749": {
"backup_id": "20140709T011749",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 01:17:49 2014",
"begin_wal": "000000010000000000000007",
"begin_xlog": "0/7000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": null,
"end_time": null,
"end_wal": null,
"end_xlog": null,
"error": null,
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27587192,
"status": "STARTED",
"tablespaces": null,
"timeline": 1,
"version": 90304
},
"20140709T012650": {
"backup_id": "20140709T012650",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 01:26:50 2014",
"begin_wal": "00000001000000000000000B",
"begin_xlog": "0/B000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": "184",
"end_time": "Wed Jul 9 01:26:56 2014",
"end_wal": "00000001000000000000000B",
"end_xlog": "0/B0000B8",
"error": null,
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27580601,
"status": "DONE",
"tablespaces": null,
"timeline": 1,
"version": 90304
},
"20140709T111913": {
"backup_id": "20140709T111913",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 11:19:13 2014",
"begin_wal": "00000001000000000000000D",
"begin_xlog": "0/D000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": "184",
"end_time": "Wed Jul 9 11:19:19 2014",
"end_wal": "00000001000000000000000D",
"end_xlog": "0/D0000B8",
"error": null,
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27587197,
"status": "DONE",
"tablespaces": null,
"timeline": 1,
"version": 90304
},
"20140709T132819": {
"backup_id": "20140709T132819",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 13:28:19 2014",
"begin_wal": "00000001000000000000000E",
"begin_xlog": "0/E000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": "184",
"end_time": "Wed Jul 9 13:28:25 2014",
"end_wal": "00000001000000000000000E",
"end_xlog": "0/E0000B8",
"error": null,
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27551277,
"status": "DONE",
"tablespaces": null,
"timeline": 1,
"version": 90304
},
"20140709T205534": {
"backup_id": "20140709T205534",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 20:55:34 2014",
"begin_wal": "000000020000000000000010",
"begin_xlog": "0/10000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": "184",
"end_time": "Wed Jul 9 20:55:40 2014",
"end_wal": "000000020000000000000010",
"end_xlog": "0/100000B8",
"error": null,
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27567304,
"status": "DONE",
"tablespaces": null,
"timeline": 2,
"version": 90304
},
"20140709T214551": {
"backup_id": "20140709T214551",
"backup_label": "None",
"begin_offset": "40",
"begin_time": "Wed Jul 9 21:45:51 2014",
"begin_wal": "000000010000000000000011",
"begin_xlog": "0/11000028",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"end_offset": "184",
"end_time": "Wed Jul 9 21:45:56 2014",
"end_wal": "000000010000000000000011",
"end_xlog": "0/110000B8",
"error": null,
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"mode": "default",
"pgdata": "/var/lib/postgresql/9.3/main",
"server_name": "syb-db",
"size": 27434875,
"status": "DONE",
"tablespaces": null,
"timeline": 1,
"version": 90304
}
},
"config": {
"active": true,
"backup_directory": "/var/lib/barman/syb-db",
"backup_options": "exclusive_backup",
"bandwidth_limit": null,
"barman_home": "/var/lib/barman",
"basebackups_directory": "/var/lib/barman/syb-db/base",
"compression": null,
"conninfo": "host=stg-db user=postgres port=2346",
"custom_compression_filter": null,
"custom_decompression_filter": null,
"description": "Main PostgreSQL Database For Suiyinbao",
"immediate_checkpoint": false,
"incoming_wals_directory": "/var/lib/barman/syb-db/incoming",
"lock_file": "/var/lib/barman/syb-db/syb-db.lock",
"minimum_redundancy": 1,
"name": "syb-db",
"network_compression": false,
"post_backup_script": null,
"pre_backup_script": null,
"retention_policy": "window 4",
"retention_policy_mode": "auto",
"ssh_command": "ssh postgres@stg-db -p 223",
"tablespace_bandwidth_limit": null,
"wal_retention_policy": "simple-wal 4",
"wals_directory": "/var/lib/barman/syb-db/wals"
},
"status": {
"archive_command": "rsync -a -e \"ssh -p 223\" %p barman@barman:/var/lib/barman/syb-db/incoming/%f",
"archive_mode": "on",
"config_file": "/etc/postgresql/9.3/main/postgresql.conf",
"current_xlog": "000000020000000000000013",
"data_directory": "/var/lib/postgresql/9.3/main",
"hba_file": "/etc/postgresql/9.3/main/pg_hba.conf",
"ident_file": "/etc/postgresql/9.3/main/pg_ident.conf",
"last_shipped_wal": "000000010000000000000012",
"pgespresso_installed": false,
"server_txt_version": "9.3.4"
},
"system_info": {
"kernel_ver": "Linux
stg-db.abc.info 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux",
"python_ver": "Python 2.7.6",
"release": "Distributor ID:\tUbuntu\nDescription:\tUbuntu 14.04 LTS\nRelease:\t14.04\nCodename:\ttrusty",
"rsync_ver": "rsync version 3.1.0 protocol version 31",
"ssh_ver": "usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]"
}
}
}
}