PostgreSQL 10 Database backup Pg_probackup Concise tutorial

Source: Internet
Author: User
Tags postgresql

Test environment Description

Os:centos Linux release 7.3.1611 (Core) X64

PG:PG10 beta3 Source Install

pg_probackup:2.0.3 Source Install

Create an archive backup directory

[Email protected] ~]# Mkdir/backupdir

[Email protected] ~]# chown postgres.postgres-r/backupdir

Database parameter Configuration

# # #-Archiving-# # #

Archive_mode = On

Archive_command = ' pg_probackup archive-push-b/backupdir--instance pg10--wal-file-path%p--wal-file-name%f '

# # # Default # #

Max_wal_senders = 10

Hot_standby = On

Full_page_writes = On

Initializing the backup directory

[Email protected] ~]# Su-postgres

[Email protected] ~]$ pg_probackup init-b/backupdir

Info:backup Catalog '/backupdir ' successfully inited

Add Backup Instance Directory

[Email protected] ~]$ pg_probackup add-instance-b/backupdir-d/pgdata10/--instance pg10

Info:instance ' pg10 ' successfully inited

Show Backup instance Configuration

[Email protected] ~]$ pg_probackup show-config-b/backupdir--instance pg10

#Backup Instance Info

PGDATA =/pgdata10/

System-identifier = 6460633300993501667

#Connection Parameters:

Pgdatabase = Postgres

#Replica Parameters:

#Logging Parameters:

#Retention Parameters:

#Compression Parameters:

Compress-algorithm = None

Compress-level = 6

[Email protected] ~]$ pg_probackup backup-b/backupdir-b full--instance pg10

Info:wait for Pg_stop_backup ()

Info:backup OVKYC7 Completed

[Email protected] ~]$

Incremental backup

[Email protected] ~]$ pg_probackup backup-b/backupdir-b PAGE--instance pg10

Info:wait for LSN 0/4000028 in archived WAL segment/backupdir/wal/pg10/000000010000000000000004

Info:wait for Pg_stop_backup ()

Info:backup Ovkyme Completed

[Email protected] ~]$

Show backup

[Email protected] ~]$ pg_probackup show-b/backupdir

BACKUP INSTANCE ' pg10 '

=============================================================================================================== ================

Instance ID Recovery time Mode WAL current/parent TLI time Data Start LSN Stop LSN St ATUs

=============================================================================================================== ================

Pg10 ovkyme 2017-09-01 10:51:56 PAGE ARCHIVE 1/0 8s 4407kB 0/4000028 0/50000f0 OK

PG10 OVKYC7 2017-09-01 10:45:57 full ARCHIVE 1/0 17s 31MB 0/2000060 0/2000198 OK

[Email protected] ~]$

Verifying backups

[Email protected] ~]$ pg_probackup validate-b/backupdir--instance pg10

Info:validate backups of the instance ' pg10 '

Info:validate Backup Ovkyme

Info:backup Validation completed successfully

Info:validate Backup OVKYC7

Info:backup Validation completed successfully

Info:all backups is valid

[Email protected] ~]$

Restore Backup

[Email protected] pgdata10]$ pg_probackup restore-b/backupdir--instance pg10-d/pgdata10/

Info:backup Validation completed successfully

Configure retention Period

[Email protected] ~]$ pg_probackup set-config-b/backupdir--instance pg10--retention-redundancy 2--retention-window 7

[Email protected] ~]$ pg_probackup show-config-b/backupdir--instance pg10

#Backup Instance Info

PGDATA =/pgdata10/

System-identifier = 6460633300993501667

#Connection Parameters:

Pgdatabase = Postgres

#Replica Parameters:

#Logging Parameters:

#Retention Parameters:

Retention-redundancy = 2

Retention-window = 7

#Compression Parameters:

Compress-algorithm = None

Compress-level = 6

[Email protected] ~]$

Parallel backup

Full

[Email protected] ~]$ pg_probackup backup-b/backupdir--instance pg10-b full-j 4

Info:wait for Pg_stop_backup ()

Info:backup OVL360 Completed

[Email protected] ~]$

Incremental

[Email protected] ~]$ pg_probackup backup-b/backupdir--instance pg10-b page-j 6

Info:wait for LSN 0/b000028 in archived WAL segment/backupdir/wal/pg10/00000002000000000000000b

Info:wait for Pg_stop_backup ()

Info:backup OVL3BK Completed

[Email protected] ~]$

[Email protected] ~]$

[Email protected] ~]$ pg_probackup show-b/backupdir--instance pg10

=============================================================================================================== ================

Instance ID Recovery time Mode WAL current/parent TLI time Data Start LSN Stop LSN St ATUs

=============================================================================================================== ================

Pg10 ovl3bk 2017-09-01 12:33:24 PAGE ARCHIVE 2/1 6s 4417kB 0/b000028 0/c0000f0 OK

PG10 OVL360 2017-09-01 12:30:11 full ARCHIVE 2/1 13s 31MB 0/9000060 0/9000198 OK

Pg10 ovkyme 2017-09-01 10:51:56 PAGE ARCHIVE 1/0 8s 4407kB 0/4000028 0/50000f0 OK

PG10 OVKYC7 2017-09-01 10:45:57 full ARCHIVE 1/0 17s 31MB 0/2000060 0/2000198 OK

[Email protected] ~]$

Restore

[Email protected] ~]$ pg_probackup restore-b/backupdir--instance pg10-d/pgdata10/-j 6

Info:backup Validation completed successfully

Info:restore of backup OVL3BK completed.

[Email protected] ~]$ pg_probackup show-b/backupdir--instance pg10-d/pgdata10

=============================================================================================================== ================

Instance ID Recovery time Mode WAL current/parent TLI time Data Start LSN Stop LSN St ATUs

=============================================================================================================== ================

Pg10 ovl3bk 2017-09-01 12:33:24 PAGE ARCHIVE 2/1 6s 4417kB 0/b000028 0/c0000f0 OK

PG10 OVL360 2017-09-01 12:30:11 full ARCHIVE 2/1 13s 31MB 0/9000060 0/9000198 OK

Pg10 ovkyme 2017-09-01 10:51:56 PAGE ARCHIVE 1/0 8s 4407kB 0/4000028 0/50000f0 OK

PG10 OVKYC7 2017-09-01 10:45:57 full ARCHIVE 1/0 17s 31MB 0/2000060 0/2000198 OK

[Email protected] ~]$

This article is from the "Yiyi" blog, make sure to keep this source http://heyiyi.blog.51cto.com/205455/1961899

PostgreSQL 10 Database backup Pg_probackup Concise tutorial

Related Article
Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.