postgresql 9.1 - Compress xlog when restoring postgres db? -
for postgres,
i used 'pg_dump' dump db, use 'psql' restore db @ other sever. found there huge volume of wal logs created @ pg_xlog/ consumed lot of disk space.
is there way postgres provides compress these wal logs automatically?
i saw 'archive_command' setup in postgres' manual. correct direction?
yang
yes, archive_command
directive you're looking for. the manual:
archive_command (string)
the shell command execute archive completed wal file segment. %p in string replaced path name of file archive, , %f replaced file name. (the path name relative working directory of server, i.e., cluster's data directory.) use %% embed actual % character in command. important command return 0 exit status if succeeds. more information see section 24.3.1.
this parameter can set in postgresql.conf file or on server command line. ignored unless archive_mode enabled @ server start. if archive_command empty string (the default) while archive_mode enabled, wal archiving temporarily disabled, server continues accumulate wal segment files in expectation command provided. setting archive_command command nothing return true, e.g. /bin/true (rem on windows), disables archiving, breaks chain of wal files needed archive recovery, should used in unusual circumstances.
the postgres wiki has 1 example:
# enable wal archiving on primary archive directory accessible # standby. if wal_keep_segments high enough number retain wal # segments required standby server, not necessary. archive_mode = on archive_command = 'cp %p /path_to/archive/%f'
Comments
Post a Comment