Re: somewhat wrong archive_command example
От | Greg Smith |
---|---|
Тема | Re: somewhat wrong archive_command example |
Дата | |
Msg-id | 4E794FB5.80400@2ndQuadrant.com обсуждение исходный текст |
Ответ на | somewhat wrong archive_command example (Peter Eisentraut <peter_e@gmx.net>) |
Ответы |
Re: somewhat wrong archive_command example
|
Список | pgsql-docs |
On 09/20/2011 09:17 AM, Peter Eisentraut wrote: > At > http://www.postgresql.org/docs/current/static/continuous-archiving.html > we say > > """ > Many people choose to use scripts to define their archive_command, so > that their postgresql.conf entry looks very simple: > > archive_command = 'local_backup_script.sh' > """ > > It seems to me, however, that even a simple archive_command like that > ought to contain at least %p, right? > Yes, you have to pass %p, and even though you can derive it from there it's easier for most if they get %f too. That whole section is really problematic. It says "Any messages written to stderr from the script will appear in the database server log", but on some platforms things printed to stdout appear there too. And without an example, it really doesn't make a good case for why a separate script can be useful in all cases. I've lost count of how many people I've seen hang themselves with impossible to giant single line archive_command setups, following the examples that are given; those blow up quite badly when things go wrong. Attached is a working local_backup_script.sh that does the same basic thing as the "Standalone Hot Backups" example. It includes lots of error checking, useful messages when it doesn't work like this: Archive directory does not exist LOG: archive command failed with exit code 1 DETAIL: The failed archive command was: ./local_backup_script.sh pg_xlog/00000001000000010000007D 00000001000000010000007D And it takes advantage of the fact that scripts will be executed in $PGDATA, by putting all the paths it uses relative to it. If I could get some general agreement this is a good direction to wander in, I'd be happy to wrap this into a full doc patch and submit it. I've been meaning to do this for a while and just never got around to it. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us
Вложения
В списке pgsql-docs по дате отправления: