Gzip wal_archives

master
Tim Möhlmann 6 years ago
parent 2cb27a9f32
commit 44dae7353c
No known key found for this signature in database
GPG Key ID: 8677988D8072E8DE

@ -216,7 +216,7 @@ checkpoint_warning = 15s # 0 disables
archive_mode = on # enables archiving; off, on, or always archive_mode = on # enables archiving; off, on, or always
# (change requires restart) # (change requires restart)
archive_command = 'test ! -f /backup/wal_archive/%f && cp %p /backup/wal_archive/%f' # command to use to archive a logfile segment archive_command = 'test ! -f /backup/wal_archive/%f && gzip < %p > /backup/wal_archive/%f' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive # placeholders: %p = path of file to archive
# %f = file name only # %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f' # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'

@ -1 +1 @@
11 4 * * * /basebackup.sh > /proc/1/fd/1 2>/proc/1/fd/2 11 4 * * 7 /basebackup.sh > /proc/1/fd/1 2>/proc/1/fd/2

@ -38,7 +38,7 @@ if not os.listdir("/data"):
subprocess.call(["tar", "--same-owner", "-zpxf", base_backups[-1] + "/base.tar.gz" , "-C", "/data"]) subprocess.call(["tar", "--same-owner", "-zpxf", base_backups[-1] + "/base.tar.gz" , "-C", "/data"])
if os.listdir("/backup/wal_archive"): if os.listdir("/backup/wal_archive"):
with open("/data/recovery.conf", "w") as rec: with open("/data/recovery.conf", "w") as rec:
rec.write("restore_command = 'cp /backup/wal_archive/%f %p'\n") rec.write("restore_command = 'gunzip < /backup/wal_archive/%f > %p'\n")
rec.write("standby_mode = off\n") rec.write("standby_mode = off\n")
os.system("chown postgres:postgres /data/recovery.conf") os.system("chown postgres:postgres /data/recovery.conf")
#os.system("sudo -u postgres pg_ctl start -D /data -o '-h \"''\" '") #os.system("sudo -u postgres pg_ctl start -D /data -o '-h \"''\" '")

Loading…
Cancel
Save