SlideShare uma empresa Scribd logo
1 de 47
Baixar para ler offline
Advanced PostgreSQL
backup & recovery
methods
Anastasia Lubennikova
Postgres@CERN 2020
1
Agenda
- Why backup?
- What is a good backup tool?
- Overview of advanced backup features
- Overview of PostgreSQL backup tools
Spoiler: this talk doesn’t contain any benchmarks.
2
Why do you need a backup?
- To restore the database after an accident
- hardware failure
- software bug
- human error
- To set up a new replica
- To create a test environment
- To inspect data from the past
3
What are the options?
- replica is not a backup
- dump a.k.a. “logical backup”
- storage snapshots
- pg_basebackup
- set of custom scripts
- PostgreSQL specific backup tools
4
What makes a good backup tool?
- Convenience
- out-of-box automatization of various routines
- documentation & support
- convenient and stable api
- Performance
- parallel execution
- compression
- incremental & differential backups
- WAL prefetch
5
What backup tools exist?
- Barman
- pgBackRest
- pg_probackup
- WAL-G
- BART
- part of the “EDB Advanced Server”
- requires pg_basebackup
6
Who is who? Barman
- https://www.pgbarman.org/
- 2ndQuadrant
- GPL v 3.0
- Python
- first release: 2011
- Two methods: basebackup & rsync
Notable features:
Synchronous streaming for “zero data loss”.
7
Who is who? pgBackRest
- https://pgbackrest.org/
- Crunchy Data
- MIT License
- C
- first release: 2014
Notable features:
Performance optimizations for large backups.
8
Who is who? pg_probackup
- https://github.com/postgrespro/pg_probackup
- Postgres Professional
- PostgreSQL License
- C
- first release: 2017 (based on pg_arman)
Notable features:
Page-level incremental backups and built-in validation.
9
Who is who? WAL-G
- https://github.com/wal-g/wal-g
- introduced by Citus Data,
now maintained by Yandex Cloud team
- Apache License, Version 2.0
- Go
- first release: 2017 ( “based on” WAL-E)
Notable features:
Out-of-box support for various cloud storages.
10
Feature list
1. Documentation & Support
2. Backup management
3. WAL archive management
4. Incremental backups
5. Compression and parallel execution
6. Remote backup
7. Cloud backup
8. Advanced restore options
9. Backup validation
10. Backup retention
11
1. Documentation & Support
12
Documentation
Barman User guide & command reference.
Great overview of backup architectures
pgBackRest User guide & command reference
pg_probackup User guide & command reference
WAL-G README
13
Installation
Barman Linux packages, Build from source
pgBackRest Linux packages, Build from source
pg_probackup Linux packages, Build from source,
Windows installer
WAL-G Linux binary, Build from source
14
Support: bug fixes
Barman https://github.com/2ndquadrant-it/barman/issues
pgBackRest https://github.com/pgbackrest/pgbackrest/issues
pg_probackup https://github.com/postgrespro/pg_probackup/issues
WAL-G https://github.com/wal-g/wal-g/issues
15
Commercial support
Barman 2ndQuadrant
pgBackRest CrunchyData
pg_probackup Postgres Professional
WAL-G
16
2. Backup management
17
Set up new PostgreSQL instance
Barman server
configuration files
pgBackRest stanza
configuration files
pg_probackup instance
configuration files, set-config command
WAL-G -
config via environment variables
18
Backup information
Barman plain
pgBackRest plain, json
+ postgresql table
pg_probackup plain, json
+ detailed wal archive info
WAL-G plain, json
19
3. WAL archive management
20
WAL archive management
Barman rsync / get-wal
pgBackRest archive-push / archive get
archive-async
pg_probackup archive-push / archive-get
WAL-G wal-push / wal-fetch
wal prefetch
21
Streaming backups
- Recovery Point Objective (RPO):
"maximum targeted period in which data might be lost
from an IT service due to a major incident"
- “RPO = 0” (Zero data loss)
can be achieved by synchronous WAL streaming
- replication slot
prevents the removal of WAL that is not yet received
(PostgreSQL feature)
22
Streaming backups
Barman streaming_archiver (pg_recievewal)
replication slot
pgBackRest
pg_probackup backup --stream
replication slot
WAL-G
23
4. Incremental backups
Full backup includes all data files.
Differential backup contains changes since last full backup.
Incremental backup contains changes since last backup.
24
Incremental backup methods
- DELTA - read everything, backup what changed
- independent method
- read load on data server
- PAGE - scan WAL to determine changed blocks
- requires WAL archive
- minimal load on data server
- PTRACK - remember changed blocks in a map
- requires core patch
- minimal load during backup
25
Incremental backups
Barman file-level incremental (DELTA)
pgBackRest file-level incremental (DELTA)
file-level differential (DELTA)
pg_probackup page-level incremental:
DELTA, PAGE, PTRACK
WAL-G page-level incremental (DELTA)
26
5. Compression and parallel execution
27
6. Remote backup
Barman SSH
pgBackRest SSH
pg_probackup SSH
WAL-G
28
7. Cloud backup
29
Backup to cloud storage
Barman scripts to ship backups to S3
pgBackRest Amazon S3
+ encryption
pg_probackup
WAL-G Amazon S3, Google Cloud Storage,
Azure Storage, Swift Object Storage
+ encryption
30
Extra backup features
- Backup from standby (All tools)
- to reduce load on master data server
- Resume backup (only pgBackRest)
31
8. Advanced restore options. PITR
Restore to a certain moment in time.
32
Point-in-time-recovery
Barman recovery target options
pgBackRest recovery target options
pg_probackup recovery target options
WAL-G
33
Partial restore
Barman
pgBackRest restore selected databases
pg_probackup restore selected databases
WAL-G
34
9. Backup validation
35
Validate backups
Barman DIY with custom hooks
on backup & restore
pgBackRest page checksums on backup
pg_probackup page checksums on backup
validate on demand
check instance
WAL-G
36
10. Backup retention
37
10. Backup retention. Redundancy = 3
38
10. Backup retention. Window = 7 days
39
Retention policy
Barman retention_policy = REDUNDANCY
retention_policy = RECOVERY WINDOW
pgBackRest redundancy
pg_probackup --retention-redundancy
--retention-window
WAL-G redundancy: retain N
window: delete before
40
Backup pinning
Barman
pgBackRest
pg_probackup ttl=0
WAL-G backup-mark
41
Archive retention
Barman
pgBackRest Archive Retention
--repo-retention-archive
pg_probackup delete --expired --wal
--wal-depth=1
WAL-G
42
Backup merging
Save space by merging old incremental backups.
43
Backup merging
Barman
pgBackRest
pg_probackup merge
--merge-expired
WAL-G
44
45
Conclusion
Barman
(rsync)
pgBackRest pg_probackup WAL-G
Support + + + +
Backup management + + + -
WAL management + + + +
Incremental backup + + + +
Compression &
parallel execution
+ + + +
46
Conclusion
Barman
(rsync)
pgBackRest pg_probackup WAL-G
Remote backup + + + +
Cloud backup - + - +
Advanced restore + + + -
Backup validation + + + -
Backup retention + + + +
47

Mais conteúdo relacionado

Mais procurados

plProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancerplProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancerelliando dias
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupNilnandan Joshi
 
pgpool-II demonstration
pgpool-II demonstrationpgpool-II demonstration
pgpool-II demonstrationelliando dias
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cSatishbabu Gunukula
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performancePostgreSQL-Consulting
 
Mysteries of the binary log
Mysteries of the binary logMysteries of the binary log
Mysteries of the binary logMats Kindahl
 
Postgresql on NFS - J.Battiato, pgday2016
Postgresql on NFS - J.Battiato, pgday2016Postgresql on NFS - J.Battiato, pgday2016
Postgresql on NFS - J.Battiato, pgday2016Jonathan Battiato
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresqlbotsplash.com
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HAharoonm
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
PostgreSQL Extensions: A deeper look
PostgreSQL Extensions:  A deeper lookPostgreSQL Extensions:  A deeper look
PostgreSQL Extensions: A deeper lookJignesh Shah
 
mysql 8.0 architecture and enhancement
mysql 8.0 architecture and enhancementmysql 8.0 architecture and enhancement
mysql 8.0 architecture and enhancementlalit choudhary
 
Faster, better, stronger: The new InnoDB
Faster, better, stronger: The new InnoDBFaster, better, stronger: The new InnoDB
Faster, better, stronger: The new InnoDBMariaDB plc
 
Oracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionOracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionMarkus Michalewicz
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015PostgreSQL-Consulting
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1Federico Campoli
 
PLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptxPLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptxjohnwick814916
 
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재PgDay.Seoul
 
Fast Start Failover DataGuard
Fast Start Failover DataGuardFast Start Failover DataGuard
Fast Start Failover DataGuardBorsaniya Vaibhav
 

Mais procurados (20)

PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
 
plProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancerplProxy, pgBouncer, pgBalancer
plProxy, pgBouncer, pgBalancer
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackup
 
pgpool-II demonstration
pgpool-II demonstrationpgpool-II demonstration
pgpool-II demonstration
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
Mysteries of the binary log
Mysteries of the binary logMysteries of the binary log
Mysteries of the binary log
 
Postgresql on NFS - J.Battiato, pgday2016
Postgresql on NFS - J.Battiato, pgday2016Postgresql on NFS - J.Battiato, pgday2016
Postgresql on NFS - J.Battiato, pgday2016
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HA
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
PostgreSQL Extensions: A deeper look
PostgreSQL Extensions:  A deeper lookPostgreSQL Extensions:  A deeper look
PostgreSQL Extensions: A deeper look
 
mysql 8.0 architecture and enhancement
mysql 8.0 architecture and enhancementmysql 8.0 architecture and enhancement
mysql 8.0 architecture and enhancement
 
Faster, better, stronger: The new InnoDB
Faster, better, stronger: The new InnoDBFaster, better, stronger: The new InnoDB
Faster, better, stronger: The new InnoDB
 
Oracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion EditionOracle RAC Internals - The Cache Fusion Edition
Oracle RAC Internals - The Cache Fusion Edition
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
 
Postgresql database administration volume 1
Postgresql database administration volume 1Postgresql database administration volume 1
Postgresql database administration volume 1
 
PLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptxPLPgSqL- Datatypes, Language structure.pptx
PLPgSqL- Datatypes, Language structure.pptx
 
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
[pgday.Seoul 2022] PostgreSQL구조 - 윤성재
 
Fast Start Failover DataGuard
Fast Start Failover DataGuardFast Start Failover DataGuard
Fast Start Failover DataGuard
 

Semelhante a Advanced backup methods (Postgres@CERN)

Tutorial all pp_pg_admin_backup_restore
Tutorial all pp_pg_admin_backup_restoreTutorial all pp_pg_admin_backup_restore
Tutorial all pp_pg_admin_backup_restoreGanesh Sawant
 
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Command Prompt., Inc
 
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...PGConf APAC
 
configuring a warm standby, the easy way
configuring a warm standby, the easy wayconfiguring a warm standby, the easy way
configuring a warm standby, the easy wayCommand Prompt., Inc
 
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptx
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptxThink_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptx
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptxPayal Singh
 
Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsVisual Engineering
 
Data integration with embulk
Data integration with embulkData integration with embulk
Data integration with embulkTeguh Nugraha
 
Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008Robert Treat
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Denish Patel
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
 
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...Symantec
 
Automating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLAutomating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLNina Kaufman
 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesJonathan Katz
 
Bareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan Duehr
Bareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan DuehrBareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan Duehr
Bareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan DuehrNETWAYS
 
PGConf APAC 2018 - PostgreSQL performance comparison in various clouds
PGConf APAC 2018 - PostgreSQL performance comparison in various cloudsPGConf APAC 2018 - PostgreSQL performance comparison in various clouds
PGConf APAC 2018 - PostgreSQL performance comparison in various cloudsPGConf APAC
 

Semelhante a Advanced backup methods (Postgres@CERN) (20)

Tutorial all pp_pg_admin_backup_restore
Tutorial all pp_pg_admin_backup_restoreTutorial all pp_pg_admin_backup_restore
Tutorial all pp_pg_admin_backup_restore
 
Backups
BackupsBackups
Backups
 
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
 
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
 
configuring a warm standby, the easy way
configuring a warm standby, the easy wayconfiguring a warm standby, the easy way
configuring a warm standby, the easy way
 
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptx
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptxThink_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptx
Think_your_Postgres_backups_and_recovery_are_safe_lets_talk.pptx
 
Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build tools
 
Data integration with embulk
Data integration with embulkData integration with embulk
Data integration with embulk
 
Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008Pro PostgreSQL, OSCon 2008
Pro PostgreSQL, OSCon 2008
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 
Pitr Made Easy
Pitr Made EasyPitr Made Easy
Pitr Made Easy
 
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
A Step-By-Step Disaster Recovery Blueprint & Best Practices for Your NetBacku...
 
Automating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQLAutomating Disaster Recovery PostgreSQL
Automating Disaster Recovery PostgreSQL
 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with Kubernetes
 
Bareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan Duehr
Bareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan DuehrBareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan Duehr
Bareos Python Plugins Hacking Workshop by Maik Aussendorf & Stephan Duehr
 
PGConf APAC 2018 - PostgreSQL performance comparison in various clouds
PGConf APAC 2018 - PostgreSQL performance comparison in various cloudsPGConf APAC 2018 - PostgreSQL performance comparison in various clouds
PGConf APAC 2018 - PostgreSQL performance comparison in various clouds
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 

Mais de Anastasia Lubennikova

Btree. Explore the heart of PostgreSQL.
Btree. Explore the heart of PostgreSQL. Btree. Explore the heart of PostgreSQL.
Btree. Explore the heart of PostgreSQL. Anastasia Lubennikova
 
Hacking PostgreSQL. Локальная память процессов. Контексты памяти.
Hacking PostgreSQL. Локальная память процессов. Контексты памяти.Hacking PostgreSQL. Локальная память процессов. Контексты памяти.
Hacking PostgreSQL. Локальная память процессов. Контексты памяти.Anastasia Lubennikova
 
Hacking PostgreSQL. Разделяемая память и блокировки.
Hacking PostgreSQL. Разделяемая память и блокировки.Hacking PostgreSQL. Разделяемая память и блокировки.
Hacking PostgreSQL. Разделяемая память и блокировки.Anastasia Lubennikova
 
Hacking PostgreSQL. Физическое представление данных
Hacking PostgreSQL. Физическое представление данныхHacking PostgreSQL. Физическое представление данных
Hacking PostgreSQL. Физическое представление данныхAnastasia Lubennikova
 
Hacking PostgreSQL. Обзор исходного кода
Hacking PostgreSQL. Обзор исходного кодаHacking PostgreSQL. Обзор исходного кода
Hacking PostgreSQL. Обзор исходного кодаAnastasia Lubennikova
 
Расширения для PostgreSQL
Расширения для PostgreSQLРасширения для PostgreSQL
Расширения для PostgreSQLAnastasia Lubennikova
 
Hacking PostgreSQL. Обзор архитектуры.
Hacking PostgreSQL. Обзор архитектуры.Hacking PostgreSQL. Обзор архитектуры.
Hacking PostgreSQL. Обзор архитектуры.Anastasia Lubennikova
 
Архитектура и новые возможности B-tree
Архитектура и новые возможности B-treeАрхитектура и новые возможности B-tree
Архитектура и новые возможности B-treeAnastasia Lubennikova
 
Советы для начинающих разработчиков PostgreSQL
Советы для начинающих разработчиков PostgreSQL Советы для начинающих разработчиков PostgreSQL
Советы для начинающих разработчиков PostgreSQL Anastasia Lubennikova
 

Mais de Anastasia Lubennikova (12)

PgconfSV compression
PgconfSV compressionPgconfSV compression
PgconfSV compression
 
Btree. Explore the heart of PostgreSQL.
Btree. Explore the heart of PostgreSQL. Btree. Explore the heart of PostgreSQL.
Btree. Explore the heart of PostgreSQL.
 
Page compression. PGCON_2016
Page compression. PGCON_2016Page compression. PGCON_2016
Page compression. PGCON_2016
 
Hacking PostgreSQL. Локальная память процессов. Контексты памяти.
Hacking PostgreSQL. Локальная память процессов. Контексты памяти.Hacking PostgreSQL. Локальная память процессов. Контексты памяти.
Hacking PostgreSQL. Локальная память процессов. Контексты памяти.
 
Hacking PostgreSQL. Разделяемая память и блокировки.
Hacking PostgreSQL. Разделяемая память и блокировки.Hacking PostgreSQL. Разделяемая память и блокировки.
Hacking PostgreSQL. Разделяемая память и блокировки.
 
Hacking PostgreSQL. Физическое представление данных
Hacking PostgreSQL. Физическое представление данныхHacking PostgreSQL. Физическое представление данных
Hacking PostgreSQL. Физическое представление данных
 
Hacking PostgreSQL. Обзор исходного кода
Hacking PostgreSQL. Обзор исходного кодаHacking PostgreSQL. Обзор исходного кода
Hacking PostgreSQL. Обзор исходного кода
 
Расширения для PostgreSQL
Расширения для PostgreSQLРасширения для PostgreSQL
Расширения для PostgreSQL
 
Hacking PostgreSQL. Обзор архитектуры.
Hacking PostgreSQL. Обзор архитектуры.Hacking PostgreSQL. Обзор архитектуры.
Hacking PostgreSQL. Обзор архитектуры.
 
Архитектура и новые возможности B-tree
Архитектура и новые возможности B-treeАрхитектура и новые возможности B-tree
Архитектура и новые возможности B-tree
 
Indexes don't mean slow inserts.
Indexes don't mean slow inserts.Indexes don't mean slow inserts.
Indexes don't mean slow inserts.
 
Советы для начинающих разработчиков PostgreSQL
Советы для начинающих разработчиков PostgreSQL Советы для начинающих разработчиков PostgreSQL
Советы для начинающих разработчиков PostgreSQL
 

Último

ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 

Último (20)

ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 

Advanced backup methods (Postgres@CERN)

  • 1. Advanced PostgreSQL backup & recovery methods Anastasia Lubennikova Postgres@CERN 2020 1
  • 2. Agenda - Why backup? - What is a good backup tool? - Overview of advanced backup features - Overview of PostgreSQL backup tools Spoiler: this talk doesn’t contain any benchmarks. 2
  • 3. Why do you need a backup? - To restore the database after an accident - hardware failure - software bug - human error - To set up a new replica - To create a test environment - To inspect data from the past 3
  • 4. What are the options? - replica is not a backup - dump a.k.a. “logical backup” - storage snapshots - pg_basebackup - set of custom scripts - PostgreSQL specific backup tools 4
  • 5. What makes a good backup tool? - Convenience - out-of-box automatization of various routines - documentation & support - convenient and stable api - Performance - parallel execution - compression - incremental & differential backups - WAL prefetch 5
  • 6. What backup tools exist? - Barman - pgBackRest - pg_probackup - WAL-G - BART - part of the “EDB Advanced Server” - requires pg_basebackup 6
  • 7. Who is who? Barman - https://www.pgbarman.org/ - 2ndQuadrant - GPL v 3.0 - Python - first release: 2011 - Two methods: basebackup & rsync Notable features: Synchronous streaming for “zero data loss”. 7
  • 8. Who is who? pgBackRest - https://pgbackrest.org/ - Crunchy Data - MIT License - C - first release: 2014 Notable features: Performance optimizations for large backups. 8
  • 9. Who is who? pg_probackup - https://github.com/postgrespro/pg_probackup - Postgres Professional - PostgreSQL License - C - first release: 2017 (based on pg_arman) Notable features: Page-level incremental backups and built-in validation. 9
  • 10. Who is who? WAL-G - https://github.com/wal-g/wal-g - introduced by Citus Data, now maintained by Yandex Cloud team - Apache License, Version 2.0 - Go - first release: 2017 ( “based on” WAL-E) Notable features: Out-of-box support for various cloud storages. 10
  • 11. Feature list 1. Documentation & Support 2. Backup management 3. WAL archive management 4. Incremental backups 5. Compression and parallel execution 6. Remote backup 7. Cloud backup 8. Advanced restore options 9. Backup validation 10. Backup retention 11
  • 12. 1. Documentation & Support 12
  • 13. Documentation Barman User guide & command reference. Great overview of backup architectures pgBackRest User guide & command reference pg_probackup User guide & command reference WAL-G README 13
  • 14. Installation Barman Linux packages, Build from source pgBackRest Linux packages, Build from source pg_probackup Linux packages, Build from source, Windows installer WAL-G Linux binary, Build from source 14
  • 15. Support: bug fixes Barman https://github.com/2ndquadrant-it/barman/issues pgBackRest https://github.com/pgbackrest/pgbackrest/issues pg_probackup https://github.com/postgrespro/pg_probackup/issues WAL-G https://github.com/wal-g/wal-g/issues 15
  • 16. Commercial support Barman 2ndQuadrant pgBackRest CrunchyData pg_probackup Postgres Professional WAL-G 16
  • 18. Set up new PostgreSQL instance Barman server configuration files pgBackRest stanza configuration files pg_probackup instance configuration files, set-config command WAL-G - config via environment variables 18
  • 19. Backup information Barman plain pgBackRest plain, json + postgresql table pg_probackup plain, json + detailed wal archive info WAL-G plain, json 19
  • 20. 3. WAL archive management 20
  • 21. WAL archive management Barman rsync / get-wal pgBackRest archive-push / archive get archive-async pg_probackup archive-push / archive-get WAL-G wal-push / wal-fetch wal prefetch 21
  • 22. Streaming backups - Recovery Point Objective (RPO): "maximum targeted period in which data might be lost from an IT service due to a major incident" - “RPO = 0” (Zero data loss) can be achieved by synchronous WAL streaming - replication slot prevents the removal of WAL that is not yet received (PostgreSQL feature) 22
  • 23. Streaming backups Barman streaming_archiver (pg_recievewal) replication slot pgBackRest pg_probackup backup --stream replication slot WAL-G 23
  • 24. 4. Incremental backups Full backup includes all data files. Differential backup contains changes since last full backup. Incremental backup contains changes since last backup. 24
  • 25. Incremental backup methods - DELTA - read everything, backup what changed - independent method - read load on data server - PAGE - scan WAL to determine changed blocks - requires WAL archive - minimal load on data server - PTRACK - remember changed blocks in a map - requires core patch - minimal load during backup 25
  • 26. Incremental backups Barman file-level incremental (DELTA) pgBackRest file-level incremental (DELTA) file-level differential (DELTA) pg_probackup page-level incremental: DELTA, PAGE, PTRACK WAL-G page-level incremental (DELTA) 26
  • 27. 5. Compression and parallel execution 27
  • 28. 6. Remote backup Barman SSH pgBackRest SSH pg_probackup SSH WAL-G 28
  • 30. Backup to cloud storage Barman scripts to ship backups to S3 pgBackRest Amazon S3 + encryption pg_probackup WAL-G Amazon S3, Google Cloud Storage, Azure Storage, Swift Object Storage + encryption 30
  • 31. Extra backup features - Backup from standby (All tools) - to reduce load on master data server - Resume backup (only pgBackRest) 31
  • 32. 8. Advanced restore options. PITR Restore to a certain moment in time. 32
  • 33. Point-in-time-recovery Barman recovery target options pgBackRest recovery target options pg_probackup recovery target options WAL-G 33
  • 34. Partial restore Barman pgBackRest restore selected databases pg_probackup restore selected databases WAL-G 34
  • 36. Validate backups Barman DIY with custom hooks on backup & restore pgBackRest page checksums on backup pg_probackup page checksums on backup validate on demand check instance WAL-G 36
  • 38. 10. Backup retention. Redundancy = 3 38
  • 39. 10. Backup retention. Window = 7 days 39
  • 40. Retention policy Barman retention_policy = REDUNDANCY retention_policy = RECOVERY WINDOW pgBackRest redundancy pg_probackup --retention-redundancy --retention-window WAL-G redundancy: retain N window: delete before 40
  • 42. Archive retention Barman pgBackRest Archive Retention --repo-retention-archive pg_probackup delete --expired --wal --wal-depth=1 WAL-G 42
  • 43. Backup merging Save space by merging old incremental backups. 43
  • 45. 45
  • 46. Conclusion Barman (rsync) pgBackRest pg_probackup WAL-G Support + + + + Backup management + + + - WAL management + + + + Incremental backup + + + + Compression & parallel execution + + + + 46
  • 47. Conclusion Barman (rsync) pgBackRest pg_probackup WAL-G Remote backup + + + + Cloud backup - + - + Advanced restore + + + - Backup validation + + + - Backup retention + + + + 47