In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Os:centos 7.5
Postgresql: 10.0
1. Software download:
Https://github.com/ossc-db/pg_rman/releases/pg_rman-1.3.7-1.pg10.rhel7.x86_64.rpm
two。 Install 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 0RU 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
Install the dependency package library and install it again:
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 path after installation:
/ usr/pgsql-10/bin/pg_rman
3. Configure pg_rman to initialize the backup directory:
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. Add user environment variables:
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 backup script:
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. Perform a backup, which can be added to a scheduled task, as follows:
[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
Confirm:
[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
Help for using 6.pg_rman:
Pg_rman-help
7. Restore:
Delete the database:
Rm-rf / pgdata/10/data/*
View backup information:
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 10purl 0000'
[postgres@postgres] $pg_rman restore-D / pgdata/10/data/-- recovery-target-time='2018-12-12 10 pgdata/10/data/ 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.
Start the database to confirm the data:
Pg_ctl start
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.