1.关闭PG实例
要调整WAL大小,必须要关闭PG实例,否则报错,如下:
[postgres@dbserver1 ~]$ pg_resetwal --wal-segsize=64 /postgresql/pgdata
pg_resetwal: error: lock file "postmaster.pid" exists
pg_resetwal: hint: Is a server running? If not, delete the lock file and try again.
所以,先关闭PG实例
[postgres@dbserver1 ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
4.调整min_wal_size 为 wal 大小的2倍
否则,直接启动会报错 ,如下:
[postgres@dbserver1 ~]$ pg_ctl start
waiting for server to start....2023-12-23 17:26:24.989 CST [3370] FATAL: "min_wal_size" must be at least twice "wal_segment_size"
2023-12-23 17:26:24.989 CST [3370] LOG: database system is shut down
stopped waiting
pg_ctl: could not start server
Examine the log output.
5.启动PG
[postgres@dbserver1 pgdata]$ pg_ctl start
waiting for server to start....2023-12-23 17:28:50.565 CST [3406] LOG: redirecting log output to logging collector process
2023-12-23 17:28:50.565 CST [3406] HINT: Future log output will appear in directory "pg_log".
done
server started