Обсуждение: archive folder maintenance

Поиск
Список
Период
Сортировка

archive folder maintenance

От
Keith Ouellette
Дата:

We are running PostgreSQL 9.1 with WAL. I am noticing the archive directory just keeps growing. It is currently at 392GB. What is the proper maintenance to keep that under control? It does not seem necessary to have that much archived. We are doing regular backups (pgdump). Any suggestions. The WAL configuration is the following:

 

wal_level = hot_standby

archive_mode = on

archive_command = 'cp %p /opt/PostgreSQL/9.1/data/archive/%f'

max_wal_senders = 2

wal_keep_segments = 1000  << I also think this is unnecessary as well should be much less in my opinion but shouldn't this deep 1000 16MB WAL files or 16GB?

 

 

Any guidance would be greatly appreciated

 

Thanks,

Keith

Re: archive folder maintenance

От
Payal Singh
Дата:
Is this a standalone server? What is the value of archive_timeout?
 
It is generally safe to delete WAL files older than a day or two. More specifically, all WAL files older than the latest base backup are safe to selete. A simple bash script will do in this case. 

You can also have alook at http://www.postgresql.org/docs/9.2/static/pgarchivecleanup.html tool which you can straightaway use. 


Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Tue, Jan 21, 2014 at 9:16 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

We are running PostgreSQL 9.1 with WAL. I am noticing the archive directory just keeps growing. It is currently at 392GB. What is the proper maintenance to keep that under control? It does not seem necessary to have that much archived. We are doing regular backups (pgdump). Any suggestions. The WAL configuration is the following:

 

wal_level = hot_standby

archive_mode = on

archive_command = 'cp %p /opt/PostgreSQL/9.1/data/archive/%f'

max_wal_senders = 2

wal_keep_segments = 1000  << I also think this is unnecessary as well should be much less in my opinion but shouldn't this deep 1000 16MB WAL files or 16GB?

 

 

Any guidance would be greatly appreciated

 

Thanks,

Keith


Re: archive folder maintenance

От
Keith Ouellette
Дата:

Payal,

 

  Thank you. This is the master with two standby replicas. The latest backup is the file in the archive directory ending in .backup right? I should be able to delete anything dated earlier? Is there a configuration in PostgreSQL to automatically do that? The archive_timeout is currently commented out, so I guess whatever the default is.

 

Thank you,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Tuesday, January 21, 2014 10:49 PM
To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Is this a standalone server? What is the value of archive_timeout?
 
It is generally safe to delete WAL files older than a day or two. More specifically, all WAL files older than the latest base backup are safe to selete. A simple bash script will do in this case. 

You can also have alook at http://www.postgresql.org/docs/9.2/static/pgarchivecleanup.html tool which you can straightaway use. 


Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Tue, Jan 21, 2014 at 9:16 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

We are running PostgreSQL 9.1 with WAL. I am noticing the archive directory just keeps growing. It is currently at 392GB. What is the proper maintenance to keep that under control? It does not seem necessary to have that much archived. We are doing regular backups (pgdump). Any suggestions. The WAL configuration is the following:

 

wal_level = hot_standby

archive_mode = on

archive_command = 'cp %p /opt/PostgreSQL/9.1/data/archive/%f'

max_wal_senders = 2

wal_keep_segments = 1000  << I also think this is unnecessary as well should be much less in my opinion but shouldn't this deep 1000 16MB WAL files or 16GB?

 

 

Any guidance would be greatly appreciated

 

Thanks,

Keith


Re: archive folder maintenance

От
Payal Singh
Дата:
Using pgarchivecleanup command in archive_cleanup_command within recovery.conf file on slave, the %r part will automatically get the latest .backupfile. 

Another way to automate it, an excellent tool that has an option for automatically removing replayed files is OmniPITR https://github.com/omniti-labs/omnipitr. In this case, you can use command 'omnipitr-cleanup'  in the archive_cleanup_command.


Hope this helps

Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Wed, Jan 22, 2014 at 8:45 AM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

Payal,

 

  Thank you. This is the master with two standby replicas. The latest backup is the file in the archive directory ending in .backup right? I should be able to delete anything dated earlier? Is there a configuration in PostgreSQL to automatically do that? The archive_timeout is currently commented out, so I guess whatever the default is.

 

Thank you,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Tuesday, January 21, 2014 10:49 PM
To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Is this a standalone server? What is the value of archive_timeout?
 
It is generally safe to delete WAL files older than a day or two. More specifically, all WAL files older than the latest base backup are safe to selete. A simple bash script will do in this case. 

You can also have alook at http://www.postgresql.org/docs/9.2/static/pgarchivecleanup.html tool which you can straightaway use. 


Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Tue, Jan 21, 2014 at 9:16 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

We are running PostgreSQL 9.1 with WAL. I am noticing the archive directory just keeps growing. It is currently at 392GB. What is the proper maintenance to keep that under control? It does not seem necessary to have that much archived. We are doing regular backups (pgdump). Any suggestions. The WAL configuration is the following:

 

wal_level = hot_standby

archive_mode = on

archive_command = 'cp %p /opt/PostgreSQL/9.1/data/archive/%f'

max_wal_senders = 2

wal_keep_segments = 1000  << I also think this is unnecessary as well should be much less in my opinion but shouldn't this deep 1000 16MB WAL files or 16GB?

 

 

Any guidance would be greatly appreciated

 

Thanks,

Keith



Re: archive folder maintenance

От
Keith Ouellette
Дата:

Payal,

 

  Thank you. I did look at the pg_archivecleanup command from the link in your first e-mail. If I have two standby servers replicating, do I configure both of them or does that cause any conflicts? The issue is the active database's archive folder, does the standby tell the active to delete them as well?

 

Thanks,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Wednesday, January 22, 2014 11:42 AM
To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Using pgarchivecleanup command in archive_cleanup_command within recovery.conf file on slave, the %r part will automatically get the latest .backupfile. 

Another way to automate it, an excellent tool that has an option for automatically removing replayed files is OmniPITR https://github.com/omniti-labs/omnipitr. In this case, you can use command 'omnipitr-cleanup'  in the archive_cleanup_command.


Hope this helps

Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Wed, Jan 22, 2014 at 8:45 AM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

Payal,

 

  Thank you. This is the master with two standby replicas. The latest backup is the file in the archive directory ending in .backup right? I should be able to delete anything dated earlier? Is there a configuration in PostgreSQL to automatically do that? The archive_timeout is currently commented out, so I guess whatever the default is.

 

Thank you,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Tuesday, January 21, 2014 10:49 PM
To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Is this a standalone server? What is the value of archive_timeout?
 
It is generally safe to delete WAL files older than a day or two. More specifically, all WAL files older than the latest base backup are safe to selete. A simple bash script will do in this case. 

You can also have alook at http://www.postgresql.org/docs/9.2/static/pgarchivecleanup.html tool which you can straightaway use. 


Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Tue, Jan 21, 2014 at 9:16 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

We are running PostgreSQL 9.1 with WAL. I am noticing the archive directory just keeps growing. It is currently at 392GB. What is the proper maintenance to keep that under control? It does not seem necessary to have that much archived. We are doing regular backups (pgdump). Any suggestions. The WAL configuration is the following:

 

wal_level = hot_standby

archive_mode = on

archive_command = 'cp %p /opt/PostgreSQL/9.1/data/archive/%f'

max_wal_senders = 2

wal_keep_segments = 1000  << I also think this is unnecessary as well should be much less in my opinion but shouldn't this deep 1000 16MB WAL files or 16GB?

 

 

Any guidance would be greatly appreciated

 

Thanks,

Keith



Re: archive folder maintenance

От
Payal Singh
Дата:
If both standby servers are replicating from the same master server, and the WALs are stored on the master server, when you set this command on any one of the recovery files, it goes on and deleted WALs only before the last .backup file,which is one and same file for both standby servers. So I don't think there will be any conflicts and issues if you set up pgarchivecommand on any one of the slaves. 

Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Wed, Jan 22, 2014 at 1:11 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

Payal,

 

  Thank you. I did look at the pg_archivecleanup command from the link in your first e-mail. If I have two standby servers replicating, do I configure both of them or does that cause any conflicts? The issue is the active database's archive folder, does the standby tell the active to delete them as well?

 

Thanks,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Wednesday, January 22, 2014 11:42 AM

To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Using pgarchivecleanup command in archive_cleanup_command within recovery.conf file on slave, the %r part will automatically get the latest .backupfile. 

Another way to automate it, an excellent tool that has an option for automatically removing replayed files is OmniPITR https://github.com/omniti-labs/omnipitr. In this case, you can use command 'omnipitr-cleanup'  in the archive_cleanup_command.


Hope this helps

Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Wed, Jan 22, 2014 at 8:45 AM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

Payal,

 

  Thank you. This is the master with two standby replicas. The latest backup is the file in the archive directory ending in .backup right? I should be able to delete anything dated earlier? Is there a configuration in PostgreSQL to automatically do that? The archive_timeout is currently commented out, so I guess whatever the default is.

 

Thank you,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Tuesday, January 21, 2014 10:49 PM
To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Is this a standalone server? What is the value of archive_timeout?
 
It is generally safe to delete WAL files older than a day or two. More specifically, all WAL files older than the latest base backup are safe to selete. A simple bash script will do in this case. 

You can also have alook at http://www.postgresql.org/docs/9.2/static/pgarchivecleanup.html tool which you can straightaway use. 


Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Tue, Jan 21, 2014 at 9:16 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

We are running PostgreSQL 9.1 with WAL. I am noticing the archive directory just keeps growing. It is currently at 392GB. What is the proper maintenance to keep that under control? It does not seem necessary to have that much archived. We are doing regular backups (pgdump). Any suggestions. The WAL configuration is the following:

 

wal_level = hot_standby

archive_mode = on

archive_command = 'cp %p /opt/PostgreSQL/9.1/data/archive/%f'

max_wal_senders = 2

wal_keep_segments = 1000  << I also think this is unnecessary as well should be much less in my opinion but shouldn't this deep 1000 16MB WAL files or 16GB?

 

 

Any guidance would be greatly appreciated

 

Thanks,

Keith




Re: archive folder maintenance

От
Keith Ouellette
Дата:

Thank you again. How often does the .backup files get created. I see sometimes that there may be a month between them and sometimes just a day. Is there a setting for that? There also does not seem to be a correlation on how may WAL files between the .backup files either. Sometime I see a few and other times a lot. Just curious on when to expect the next .backup to occur.

 

Thanks

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Wednesday, January 22, 2014 6:30 PM
To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

If both standby servers are replicating from the same master server, and the WALs are stored on the master server, when you set this command on any one of the recovery files, it goes on and deleted WALs only before the last .backup file,which is one and same file for both standby servers. So I don't think there will be any conflicts and issues if you set up pgarchivecommand on any one of the slaves. 

Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Wed, Jan 22, 2014 at 1:11 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

Payal,

 

  Thank you. I did look at the pg_archivecleanup command from the link in your first e-mail. If I have two standby servers replicating, do I configure both of them or does that cause any conflicts? The issue is the active database's archive folder, does the standby tell the active to delete them as well?

 

Thanks,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Wednesday, January 22, 2014 11:42 AM

To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Using pgarchivecleanup command in archive_cleanup_command within recovery.conf file on slave, the %r part will automatically get the latest .backupfile. 

Another way to automate it, an excellent tool that has an option for automatically removing replayed files is OmniPITR https://github.com/omniti-labs/omnipitr. In this case, you can use command 'omnipitr-cleanup'  in the archive_cleanup_command.


Hope this helps

Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Wed, Jan 22, 2014 at 8:45 AM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

Payal,

 

  Thank you. This is the master with two standby replicas. The latest backup is the file in the archive directory ending in .backup right? I should be able to delete anything dated earlier? Is there a configuration in PostgreSQL to automatically do that? The archive_timeout is currently commented out, so I guess whatever the default is.

 

Thank you,

Keith

 


From: Payal Singh [payal@omniti.com]
Sent: Tuesday, January 21, 2014 10:49 PM
To: Keith Ouellette
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] archive folder maintenance

Is this a standalone server? What is the value of archive_timeout?
 
It is generally safe to delete WAL files older than a day or two. More specifically, all WAL files older than the latest base backup are safe to selete. A simple bash script will do in this case. 

You can also have alook at http://www.postgresql.org/docs/9.2/static/pgarchivecleanup.html tool which you can straightaway use. 


Payal Singh,
OmniTI Computer Consulting Inc.
Junior Database Administrator,
Phone: 240.646.0770 x 253


On Tue, Jan 21, 2014 at 9:16 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

We are running PostgreSQL 9.1 with WAL. I am noticing the archive directory just keeps growing. It is currently at 392GB. What is the proper maintenance to keep that under control? It does not seem necessary to have that much archived. We are doing regular backups (pgdump). Any suggestions. The WAL configuration is the following:

 

wal_level = hot_standby

archive_mode = on

archive_command = 'cp %p /opt/PostgreSQL/9.1/data/archive/%f'

max_wal_senders = 2

wal_keep_segments = 1000  << I also think this is unnecessary as well should be much less in my opinion but shouldn't this deep 1000 16MB WAL files or 16GB?

 

 

Any guidance would be greatly appreciated

 

Thanks,

Keith




Re: archive folder maintenance

От
Sameer Kumar
Дата:

On Thu, Jan 23, 2014 at 12:37 PM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:
Thank you again. How often does the .backup files get created.

I am not sure, but I think it gets generated whenever you do a pg_start_backup().


Best Regards,
Sameer Kumar | Database Consultant
ASHNIK PTE. LTD.
101 Cecil Street, #11-11 Tong Eng Building, Singapore 069533
M : +65 8110 0350 T: +65 6438 3504 | www.ashnik.com
www.facebook.com/ashnikbiz | www.twitter.com/ashnikbiz

email patch

This email may contain confidential, privileged or copyright material and is solely for the use of the intended recipient(s).

Вложения