Postgres流式備份(3)配置檔案

2021-10-03 10:22:29 字數 2421 閱讀 3537

屬性

位置說明

active

伺服器預設true,false時只能用於診斷該伺服器,無法執行備份等命令

archiver

全域性/服務

預設true,指定是否啟用歸檔日誌備份

backup_directory

服務服務備份存放位置

backup_method

全域性/服務

預設rsync,使用rsync備份;配置為postgres將使用pg_basebackup備份

bandwidth_limit

全域性/服務

執行最大傳輸速度,單位kb/s,預設為0(無限制)

basebackup_retry_sleep

全域性/服務

基本備份的重試等待秒數,預設為30

basebackup_retry_times

全域性/服務

基本備份的重試次數,預設為0

compression

全域性/服務

指定wal壓縮演算法包括gzip、bzip2、pigz、pygzip、pybzip2

conninfo

服務barman連線到資料庫的連線字串

last_backup_maximum_age

全域性/服務

最大保留備份週期,語法為「i(days

minimum_redundancy

全域性/服務

最小保留備份數

recovery_options

全域性/服務

恢復操作選型,只支援get-wal,預設為空。

retention_policy

全域性/服務

保留定期備份和存檔日誌的策略。如果留空,則不會強制執行保留策略。 「redundancy i」表示強制保留i個備份;支援保留指定週期,如「recovery window of i days」、「recovery window of i weeks」、「recovery window of i months」

reuse_backup

全域性/服務

預設「off」,關閉;「copy」:重用最新的可用備份,並拷貝未變更檔案,只複製變更檔案以減少備份時間;「link」:重用最新的可用備份,未變更檔案使用hard link(需系統支援),只複製變更檔案以減少備份時間和空間

slot_name

全域性/服務

但streaming_archiver為on時,receive-wal命令使用的複製槽,postgresql 9.4及以上版本可用

ssh_command

服務barman ssh登入到postgres伺服器命令

streaming_archiver

全域性/服務

配置是否用wal streaming接收日誌,預設為false。為on時,將使用path_prefix路徑下的pg_receivewal/pg_receivexlog進行流複製。

streaming_conninfo

服務通過流複製協議連線到postgres伺服器的連線字串

barman執行操作前後執行的hook指令碼

詳見

; [資料庫命名],無需資料庫實際名稱

[pg1]

; 描述,供閱讀使用

description = "example of postgresql database (streaming-only)"

; 備份目錄

backup_directory = /home/backup/192.168.220.133

; postgres連線字串(必填)

conninfo = host=pg user=barman dbname=postgres

; postgresql 流複製連線字串

; pg_basebackup備份和pg_receivexlog流複製wal時使用

; 注意: 使用者streaming_barman是乙個具備replication許可權的普通使用者

streaming_conninfo = host=pg user=streaming_barman

; 備份設定 (通過pg_basebackup實現)

backup_method = postgres

;streaming_backup_name = barman_streaming_backup

; wal streaming設定 (通過pg_receivexlog實現)

streaming_archiver = on

slot_name = barman

;streaming_archiver_name = barman_receive_wal

;streaming_archiver_batch_size = 50

; path setting for this server

;path_prefix = "/usr/pgsql-9.6/bin"

Postgres流式備份(6)備份和恢復

定時維護,強制執行保留策略 wal檔案管理 barman如通過rpm安裝將自動新增定時配置檔案 etc cron.d barman,內容如下,設定每分鐘進行一次定時維護 m h dom mon dow user command barman x usr bin barman usr bin barm...

Postgres流式備份(1)Barman概述

barman是使用python編寫的postgresql開源備份和恢復管理器 pg basebackup 用於資料庫全量備份 pg receivewal pg receivexlog 用於基於全量對wal增量備份,可實現很低的資料丟失時間 archive command wal檔案切換 寫滿指定大小...

postgres 連續備份

準備 main pg 建立postgres使用者,能夠免密登入到backup pg backup pg 建立postgres使用者 1 main pg修改配置,開啟歸檔模式 不開啟,產生少量wal檔案 開啟,產生完整wal檔案 mkdir home postgres archive wals hos...