In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what is the backup and restore method of pg_basebackup multi-tablespace in PG". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the backup and restore method of pg_basebackup multi-tablespace in PG".
-- incremental backup, pg_basebackup-- opens an archive psql mydb postgresalter system set wal_level='replica';alter system set archive_mode='on';-- to modify the archive_command parameter, "% p" contains the file name of the full path information, "% f" does not contain alter system set archive_command='cp% p / pgbackup/archive_wals/%f';select pg_reload_conf ();-- View, pay attention to the space show archive_command after -- basic backup. Backup user must have superuser permission pg_basebackup-Ft-Pv-Xf-z-p 1921-D / pgbackup/backups-- to view the current time select current_timest-- switch log select pg_switch_wal () -- restore testing-- stop pg_ctl-D $PGDATA-mi stop-- move the original library directory mv / pgdata/10/data/ pgdata/10/data_bak2019-- to create a new directory mkdir-p / pgdata/10/data chmod 0770 / pgdata/10/datatar-zxvf / pgbackup/backups/base.tar.gz-C / pgdata/10/data/-- Note: if there are multiple table spaces, after decompressing the basic package, you can refer to the tablespace_map file and extract other table spaces to the specified directory. For example, [postgres@pgnode1 backups] $cat tablespace_map 16385 / pgdata/10/data/pg_tbs/tbs_ myDB [postgres @ pgnode1 backups] $--View backup information [postgres@pgnode1 data] $cat backup_label START WAL LOCATION: 0Charger 19000028 (file 0000000100000000000019) CHECKPOINT LOCATION: 0/19000060BACKUP METHOD: streamedBACKUP FROM: masterSTART TIME: 2019-01-15 16:01:40 CSTLABEL: pg_basebackup basebackup-- decompress other tablespaces tar-zxvf / pgbackup/backups/16385.tar.gz-C / pgdata/10/data/pg_tbs/tbs_mydb-- configuration recovery.conf file cp / opt/pgsql/share/postgresql/recovery.conf.sample / pgdata/10/data/recovery.confecho "restore_command='cp / pgbackup/archive_wals/%f% p'" > > / pgdata/10/data/recovery.conf [postgres@pgnode1 data] $cat / pgdata/10/data/recovery.conf | grep-v'# 'restore_command='cp / pgbackup/archive_wals/%f% p '# recovery_target_timeline='latest' is displayed by default -- start the database pg_ctl start-D $PGDATA-- current database server ip and portselect inet_server_addr (), inet_server_port ();-- orselect now ();-- based on point-in-time select current_timestrestore_target_time='2019-01-15 16-veg 1718. 590319-08mm-- based on restore point select pg_create_restore_point ('restore_point'); restore_target_name='restore_point';-- based on transaction select txid_current () Restore_target_txid=-- is based on the timeline (timeline, increase one natural number at a time for restore) [postgres@pgnode1 ~] $pg_controldata $PGDATA | grep TimeLineIDLatest checkpoint's TimeLineID: 2Latest checkpoint's PrevTimeLineID: 2recover_target_timeline=2recover_target_time='2019-01-15 21pg_controldata 02pg_controldata 00' Thank you for your reading. This is the content of "what is the backup and recovery method of pg_basebackup multi-tablespace in PG". After the study of this article I believe that you have a deeper understanding of what is the backup and restore method of pg_basebackup multi-tablespace in PG, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.