PostgreSQL 数据库常用归档配置

1. 非压缩

archive_command = 'cp %p /appdata/pgsql/pg_archive/%f && echo %f >> /appdata/pgsql/pg_archive/archive.list'
restore_command = 'cp /appdata/pgsql/pg_archive/%f %p'

2. 压缩 gzip

archive_command = 'gzip < %p > /appdata/pgsql/pg_archive/%f.gz'
restore_command = 'gunzip < /appdata/pgsql/pg_archive/%f.gz > %p'

3. 压缩 bzip2

archive_command = 'bzip2 < %p > /appdata/pgsql/pg_archive/%f.bz2'
restore_command = 'bunzip2 < /appdata/pgsql/pg_archive/%f.bz2 > %p'

4. 压缩 lz4

archive_command = 'lz4 -f -q -z %p /appdata/pgsql/pg_archive/%f.lz4'
restore_command = 'lz4 -f -q -d /appdata/pgsql/pg_archive/%f.lz4 %p'

5. scp方式

archive_command = 'scp %p dragon02:/appdata/pgsql/pg_archive/%f'
restore_command = 'scp dragon02:/appdata/pgsql/pg_archive/%f %p'

6. rsync方式

archive_command = 'rsync -a %p barman@dragon02:/appdata/pgsql/pg_archive/%f'
restore_command = 'rsync -a barman@dragon02:/appdata/pgsql/pg_archive/%f %p'

 7. windows

archive_command = 'copy "%p" "C:\\appdata\\pgsql\\pg_archive\\%f"'

 文章允许转载,但需注明原文地址,谢谢。

posted @ 2020-07-11 08:45  风雨飘泊  阅读(957)  评论(0编辑  收藏  举报