postgres 开启wal归档
更新:HHH   时间:2023-1-7


1.postgres 开启wal归档:

a.修改wal_level参数:
alter system set wal_level= 'replica';

postgres=# alter system set wal_level= 'replica';
ALTER SYSTEM

b.修改archive_mode参数:

alter system set archive_mode= 'on';

postgres=# alter system set archive_mode= 'on';
ALTER SYSTEM

c.修改archive_command 参数:

alter system set archive_command = '/bin/cp -i %p /pgdata/10/archive_wal/%f';

postgres=# alter system set archive_command = '/bin/cp -i %p /pgdata/10/archive_wal/%f';
ALTER SYSTEM

2.PostgreSQL手动切换WAL日志的命令:
PG10之前:
select pg_switch_xlog();

PG10之后:
select pg_switch_wal();

返回数据库教程...