0

we are using postgresql for ambari DB , in our linux server - rhel 7.2

postgres -V postgres (PostgreSQL) 9.2.13

we noticed that pg_xlog folder consuming 198g , and its gives /var to get 100% size

so after google searching

we noticed about postgresql.conf that have the parameter - wal_keep_segments

according to documentation , wal_keep_segments Specifies the minimum number of past log file segments kept in the pg_xlog directory

my questions are:

  1. is it safe to use this parameter - wal_keep_segments , and doing purging on pg_xlog folder
  2. based on the size of the folder that is nearly to 200g , what is the value that we need to set to wal_keep_segments
1
  • Assuming the WAL files are the default size of 16MB, wal_keep_segments would have to have been set to at least 12,800 to drive 200GB of use. If it was no set that high, then it is not the culprit. Commented Jun 16, 2021 at 15:10

1 Answer 1

1

You should ask whoever set wal_keep_segments why they did it. Typically it is done for pg_rewind or streaming replication.

It is no problem to reset the parameter to its default value 0. Then, when the next checkpoint runs, old WAL segments should be removed.

Never delete WAL segments manually.

5
  • so you are recommended to set wal_keep_segments=0 ? , sorry that I asked this , but this is production server and its very critical server Commented Jun 16, 2021 at 12:03
  • about "Never delete WAL segments manually." yes we are understand , thank you , but since the disk is full then we need to use the parameter - wal_keep_segments , Commented Jun 16, 2021 at 12:07
  • Setting wal_keep_segements = 0 will keep PostgreSQL happy. But the may be consequences, for example a standby server that loses connection. Commented Jun 16, 2021 at 13:01
  • do you mean if we have a standby postgresql server? ( sorry for the Question ) Commented Jun 16, 2021 at 14:17
  • Yes, that might be one reason for the setting. Commented Jun 16, 2021 at 14:27

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.