91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

postgresql使用pg_rman備份恢復

發布時間:2020-07-05 09:03:35 來源:網絡 閱讀:1135 作者:春秋小記 欄目:數據庫

os:centos 7.5
postgresql: 10.0
1.軟件下載:
https://github.com/ossc-db/pg_rman/releases/pg_rman-1.3.7-1.pg10.rhel7.x86_64.rpm

2.安裝pg_rman:
[root@my-mm ~]# yum localinstall pg_rman-1.3.7-1.pg10.rhel7.x86_64.rpm
Loaded plugins: fastestmirror
Examining pg_rman-1.3.7-1.pg10.rhel7.x86_64.rpm: pg_rman-1.3.7-1.pg10.rhel7.x86_64
Marking pg_rman-1.3.7-1.pg10.rhel7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pg_rman.x86_64 0:1.3.7-1.pg10.rhel7 will be installed
--> Processing Dependency: postgresql10-libs for package: pg_rman-1.3.7-1.pg10.rhel7.x86_64
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: mirrors.cn99.com
--> Finished Dependency Resolution
Error: Package: pg_rman-1.3.7-1.pg10.rhel7.x86_64 (/pg_rman-1.3.7-1.pg10.rhel7.x86_64)
           Requires: postgresql10-libs
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

安裝依賴包庫,再次安裝::
rpm -ivh https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7.5-x86_64/pgdg-centos10-10-2.noarch.rpm
yum localinstall pg_rman-1.3.7-1.pg10.rhel7.x86_64.rpm
安裝后的pg_rman 路徑:
/usr/pgsql-10/bin/pg_rman

3.配置pg_rman初始化備份目錄:
cd /pgdata/10/backup
/usr/pgsql-10/bin/pg_rman init -B /pgdata/10/backup/
INFO: ARCLOG_PATH is set to '/pgdata/10/archive_wal'
INFO: SRVLOG_PATH is set to '/pgdata/10/log'


4.添加用戶環境變量:

su - postgres

vi ~/.bash_profile

export ARCLOG_PATH=/pgdata/10/archive_wal
export SRVLOG_PATH=/pgdata/10/log
export BACKUP_PATH=/pgdata/10/backup

5.pg_rman備份腳本:
vim /pgdata/10/script/pg_rmanbackup.sh
#!/bin/bash
source ~/.bash_profile
export ARCLOG_PATH='/pgdata/10/archive_wal'
export SRVLOG_PATH='/pgdata/10/log'
export BACKUP_PATH='/pgdata/10/backup'

/usr/pgsql-10/bin/pg_rman backup --backup-mode=full --progress -Z --keep-data-days=7 --keep-arclog-days=7 ;
/usr/pgsql-10/bin/pg_rman validate;

6.執行備份,可以添加到定時任務,下面為手動執行:
[postgres@postgres]$ chmod +x pg_rmanbackup.sh
[postgres@postgres]$ ./pg_rmanbackup.sh
INFO: copying database files
Processed 985 of 985 files, skipped 0
INFO: copying archived WAL files
Processed 4 of 4 files, skipped 0
INFO: backup complete
INFO: Please execute 'pg_rman validate' to verify the files are correctly copied.
INFO: start deleting old archived WAL files from ARCLOG_PATH (keep days = 7)
INFO: the threshold timestamp calculated by keep days is "2018-12-05 00:00:00"
INFO: start deleting old backup (keep after = 2018-12-05 00:00:00)
INFO: does not include the backup just taken
INFO: validate: "2018-12-12 03:28:38" backup and archive log files by CRC
INFO: backup "2018-12-12 03:28:38" is valid

確認:
[postgres@postgres]$ pg_rman show -B /pgdata/10/backup/
=====================================================================
 StartTime           EndTime              Mode    Size   TLI  Status
=====================================================================
2018-12-12 03:28:38  2018-12-12 03:28:46  FULL  5184kB     1  OK

6.pg_rman使用幫助:
pg_rman --help


7.恢復:
刪除數據庫:
rm -rf /pgdata/10/data/*
查看備份信息:
pg_rman show

=====================================================================
 StartTime           EndTime              Mode    Size   TLI  Status
=====================================================================
2018-12-12 03:28:38  2018-12-12 03:28:46  FULL  5184kB     1  OK

pg_rman  restore -D /pgdata/10/data/ --recovery-target-time='2018-12-12 10:00:00'
[postgres@postgres]$ pg_rman  restore -D /pgdata/10/data/ --recovery-target-time='2018-12-12 10:00:00' -B /pgdata/10/backup/
WARNING: pg_controldata file "/pgdata/10/data//global/pg_control" does not exist
INFO: the recovery target timeline ID is not given
INFO: use timeline ID of latest full backup as recovery target: 1
INFO: calculating timeline branches to be used to recovery target point
INFO: searching latest full backup which can be used as restore start point
INFO: found the full backup can be used as base in recovery: "2018-12-12 03:28:38"
INFO: copying online WAL files and server log files
INFO: clearing restore destination
INFO: validate: "2018-12-12 03:28:38" backup and archive log files by SIZE
INFO: backup "2018-12-12 03:28:38" is valid
INFO: restoring database files from the full mode backup "2018-12-12 03:28:38"
INFO: searching incremental backup to be restored
INFO: searching backup which contained archived WAL files to be restored
INFO: backup "2018-12-12 03:28:38" is valid
INFO: restoring WAL files from backup "2018-12-12 03:28:38"
INFO: restoring online WAL files and server log files
INFO: generating recovery.conf
INFO: restore complete
HINT: Recovery will start automatically when the PostgreSQL server is started.

啟動數據庫確認數據:
pg_ctl start

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

邢台市| 靖安县| 南平市| 嘉义县| 兰西县| 台中县| 全州县| 泗阳县| 垣曲县| 台南市| 南乐县| 巴林左旗| 洪雅县| 合江县| 丰台区| 靖西县| 吴忠市| 翁牛特旗| 广汉市| 庆阳市| 四子王旗| 福州市| 汨罗市| 基隆市| 开阳县| 城步| 涪陵区| 周宁县| 乐至县| 吴川市| 平阴县| 仪征市| 满城县| 巴南区| 龙南县| 板桥市| 来凤县| 南投市| 邹城市| 海城市| 民权县|