In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "the configuration method of pgsql archiving log". In the daily operation, I believe that many people have doubts about the configuration method of pgsql archiving log. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "configuration method of pgsql archiving log". Next, please follow the editor to study!
The archive configuration involves several parameters as follows:
#-Archiving-
Whether to open archiving or not
# archive_mode = off # enables archiving; off, on, or always
# (change requires restart)
Archive command, note the meaning of% p% f%% format.
% p is the path to the archived redo file
% f is the file name of the archived redo document
%% is a percent sign
# archive_command =''# command to use to archive a logfile segment
# placeholders:% p = path of file to archive
#% f = file name only
# e.g. 'test!-f / mnt/server/archivedir/%f & & cp% p / mnt/server/archivedir/%f'
Time-out forced archiving, for example, if there is no activity in the database for 10 minutes and an redo file is not finished, it will not be archived
But if we want the database to switch one log in at least 10 minutes, we can use archive_timeout
# archive_timeout = 0 # force a logfile segment switch after this
# number of seconds; 0 disables
The archiving configuration is as follows:
Suppose the directory where the redo archive is stored is / mnt/server/archivedir/
Vi $PGDATA/arch.sh
#! / bin/bash
Source / var/lib/pgsql/.bash_profile
Test!-f / pg_arch/$1 & & cp-- preserve=timestamps $2 / pg_arch/$1; find / pg_arch/-type f-mtime + 7-exec rm-f {}\
Chmod 500$ PGDATA/arch.sh
Wal_level = replica
Archive_mode = on
Archive_command ='$PGDATA/arch.sh% f% p'
Interpretation:
-- preserve=timestamps
When copying a file, the timestamp of the copied file (including the modification time of the file). Why must you copy with the modification timestamp? suppose that the redo is generated quickly, the archiving is slow, or the archiving card is dead, the filing is delayed for several days, and the timestamp of the old file is not copied.
What is actually written is the timestamp of the copy time, which can vary greatly.
Find-mtime + 7 finds the file modified 7 days ago in the ARCH directory and deletes it
At this point, the study on the "configuration method of pgsql archiving logs" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.