Upload
enterprisedb
View
171
Download
6
Tags:
Embed Size (px)
Citation preview
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 1
Backup and Recovery for Postgres and Postgres Plus with BART August 2015 To listen to the recording of this presentation,
please visit www.enterprisedb.com > Resources > Webcasts > On-demand Webcasts
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 2
• Considerations for Backup and Recovery with Postgres • Backup Options for Postgres • Backup and Recovery Tool (BART) from EDB
• Walkthrough of BART Features • Review Benefits of BART • Call to Action
Agenda
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 3
• Why backup? − To recover from a failure − To seed a replication slave − To create and manage reusable test or development systems
• Understand your Recovery SLAs − How much time allowed to restore?
• Plan for retention policies and backup intervals − How far back to you need to be able to restore? − Do you need to maintain specific backups for historical purposes? − Understand performance impacts when performing backups for appropriate
scheduling
Considerations for Backup and Recovery with Postgres
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 4
• Logical Backups - − SQL dump with pg_dump / pg_dumpall
• Physical Backups - − File system snapshot (tar -cf backup.tar /usr/local/pgsql/data) − pg_basebackup, with continuous archiving and Point in Time Recovery (PITR)
• Both Postgres capabilities require lots of custom scripts to manage retention, compression, WAL files, restore procedures and more
EDB’s Backup and Recovery Tool (BART) simplifies and reduces errors in the backup and recovery process
Backup Options for Postgres
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 5
• Complete, hot, physical backups of multiple Postgres servers • Backup and recovery management of local or remote hosts • Policy enforced management of files required for recovery • Store backup data in compressed formats • Verify backup data with MD5 checksum • Advanced support for tablespaces (restoration on different paths, checksums) • Disk space awareness • Rich reporting to show backup time, size, WAL file information • Optional friendly name for backups
Backup and Recovery Tool Simplifies and reduces errors with a system-wide catalog and command line tool that allows online backup and recovery across local and remote PostgreSQL and PPAS Servers.
Backup and Recovery Tool Feature Highlights
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 6
1. Configuring the BART Catalog 2. Setting up Archived WALs for PITR 3. Taking your first backup (bart
backup) − Including friendly name support and disk
space awareness
4. Managing your Backup files − Retention Policies and Obsolete
Management (bart manage)
5. Review the reporting output (bart show-servers | show-backups)
6. Running a restore (bart restore)
For reference – bart subcommands - • BACKUP • RESTORE • SHOW-SERVERS • SHOW-BACKUPS • MANAGE • DELETE • VERIFY-CHKSUM
Product Walkthrough
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 7
• Define global parameters including − backup path − retention policy − log files − xlog-method
• Manage local and remote databases • Define defaults for each server
− friendly backup names − remote hosts for recovery − archive commands to support PITR − WAL compression
1) The BART Catalog Provides Flexible Configuration [BART]!bart-host= [email protected]!backup_path = /opt/backup!pg_basebackup_path = /opt/9.4AS/bin/pg_basebackup!retention_policy = 6 BACKUPS!logfile = /tmp/bart.log!xlog-method = stream! ![PPAS94]!host = 127.0.0.1!port = 5444!user = enterprisedb!backup-name = ppas94_%year%month%dayT%hour:%minute!archive_command = 'cp %p %a/%f'!description = "PPAS 94 server"! ![PPAS93_remote]!host = 192.168.2.24!....!description = "PPAS 93 remote server”!wal-compression = enabled! ![PG94_remote]!host = 192.168.2.24!port = 5432!user = postgres!backup-name = pg94_%year%month%dayT%hour:%minute!remote-host = [email protected]!description = "PostgreSQL 94 remote server"!
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 8
• Use the bart SHOW-SERVERS command to view the ARCHIVE PATH to send WAL Archives to
• Configure postgresql.conf to enable WAL Archival − Set wal_level to archive. − Set archive_mode to on. − Set the archive_command to copy the
WAL files to the BART backup catalog. − Set max_wal_senders (1 for BART, at
least 2 if the xlog-method=stream used)
2) Setup PITR with WAL Archiving
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 9
• Use the bart SHOW-SERVERS command to view the ARCHIVE PATH to send WAL Archives to
• Configure postgresql.conf to enable WAL Archival − Set wal_level to archive. − Set archive_mode to on. − Set the archive_command to copy the
WAL files to the BART backup catalog − Set max_wal_senders (At least 1 for
BART, at least 2 if the xlog-method=stream used)
2) Setup PITR with WAL Archiving
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 10
• Get help with the bart backup –h option
• Backup server AS94 using the friendly name feature (bart backup --backup-name)
• New disk space awareness feature provide additional intelligence
3) Start Using BART – Take a Backup
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 11
• Get help with the bart backup –h option
• Backup server AS94 using the friendly name feature (bart backup --backup-name)
• New disk space awareness feature provide additional intelligence
3) Start Using BART – Take a Backup
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 12
• Get help with the bart backup –h option
• Backup server AS94 using the friendly name feature (bart backup --backup-name)
• New disk space awareness feature provide additional intelligence
3) Start Using BART – Take a Backup
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 13
• Setup Retention Policies in BART Config
• Review Help and options for bart manage -h !
• Execute bart manage commands − bart manage –n (--dry-run) to preview
system changes − bart manage (w/ no options) to perform
regular retention (mark as obsolete) and compression management
− bart manage –d to remove Obsolete files from the systems
− bart manage –c keep to mark certain backups and their WAL files for KEEP
4) Managing your Backup Files
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 14
• Setup Retention Policies in BART Config • Review Help and options for bart manage -h !
• Execute bart manage commands − bart manage –n (--dry-run) to preview
system changes − bart manage (w/ no options) to perform
regular retention (mark as obsolete) and compression management
− bart manage –d to remove Obsolete files from the systems
− bart manage –c keep to mark certain backups and their WAL files for KEEP
4) Managing your Backup Files
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 15
• Setup Retention Policies in BART Config • Review Help and options for bart manage -h !
• Execute bart manage commands − bart manage –n (--dry-run) to
preview system changes − bart manage (w/ no options) to perform
regular retention (mark as obsolete) and compression management
− bart manage –d to remove Obsolete files from the systems
− bart manage –c keep to mark certain backups and their WAL files for KEEP
4) Managing your Backup Files
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 16
• Setup Retention Policies in BART Config • Review Help and options for bart manage -h !
• Execute bart manage commands − bart manage –n (--dry-run) to preview
system changes − bart manage (w/ no options) to
perform regular retention (mark as obsolete) and compression management
− bart manage –d to remove Obsolete files from the systems
− bart manage –c keep to mark certain backups and their WAL files for KEEP
4) Managing your Backup Files
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 17
• Setup Retention Policies in BART Config • Review Help and options for bart manage -h !
• Execute bart manage commands − bart manage –n (--dry-run) to preview
system changes − bart manage (w/ no options) to perform
regular retention (mark as obsolete) and compression management
− bart manage –d to remove Obsolete files from the systems
− bart manage –c keep to mark certain backups and their WAL files for KEEP
4) Managing your Backup Files
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 18
• Setup Retention Policies in BART Config • Review Help and options for bart manage -h !
• Execute bart manage commands − bart manage –n (--dry-run) to preview
system changes − bart manage (w/ no options) to perform
regular retention (mark as obsolete) and compression management
− bart manage –d to remove Obsolete files from the systems
− bart manage –c keep to mark certain backups and their WAL files for KEEP
4) Managing your Backup Files
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 19
• bart show-servers to get detailed information about each server being managed − Including retention policy, disk
utilization, number of WAL archive files and more
• bart show-backups –s <server> to see details about all backups for a given server − Including Base backup size, detailed
WAL information, and when a file was used for restore
5) Review the reporting output (bart show-servers | show-backups)
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 20
• bart show-servers to get detailed information about each server being managed − Including retention policy, disk utilization,
number of WAL archive files and more
• bart show-backups –s <server> to see details about all backups for a given server − Including Base backup size, detailed
WAL information, and when a file was used for restore
5) Review the reporting output (bart show-servers | show-backups)
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 21
• Shutdown the database server you are restoring too. • Decide where to restore cluster and tablespace files
− New empty directories (Action: create the new directory w/ appropriate permissions) − Reuse existing directories (Action: delete all files and subdirectories, but make a backup copy first) − Note: Be sure to save any recent WAL files in pg_xlog that haven’t been archived to BART server WAL
archive location <server_name>/archived_wals
• Run bart restore –s <server> -i <backup> -p <restore_path> -r <remote_user>!− Can get the id or friendly name from bart show-backups!− Base backup restored to –p <restore_path>, WAL files are copied to restore_path/archived_wals
subdirectory
• Copy any WAL Files from pg_xlog to the new server
6) Restore BART
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 22
• Eliminates custom script building and maintenance • No need to shut down your database to take backups • Compressed backup use less storage
• Tablespace file management policies • Verification guards against corrupt files • Enterprise-wide support
• Integrates with existing CRON jobs
Summary - BART Benefits
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 23
• Try BART today! http://www.enterprisedb.com/edb-backup-and-recovery-tool − Downloads − Documentation − Data sheets − Blog Posts − and more!
• Take advantage of EnterpriseDB Postgres Traininghttp://www.enterprisedb.com/products-services-training/training
Call to Action
© Copyright EnterpriseDB Corporation, 2015. All rights reserved. 24