Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9V3F-00085W-1l for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2015 09:08:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z9V3D-0002k9-Vt for pgsql-general@arkaria.postgresql.org; Mon, 29 Jun 2015 09:08:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9V05-0008RW-Ex for pgsql-general@postgresql.org; Mon, 29 Jun 2015 09:05:13 +0000 Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z9Uzw-0004ht-BR for pgsql-general@postgresql.org; Mon, 29 Jun 2015 09:05:12 +0000 Received: by wgqq4 with SMTP id q4so135472342wgq.1 for ; Mon, 29 Jun 2015 02:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=fDc1Q/7KlV70ESoEmqs737DmXjRYYnM64EDEn3I5xPc=; b=MzT7sNitXv4VUr8yxiMng46GH3j07VIrtxp+IgqflGSBjFot71US4v9jaaQ7HzZ7sx 6aycKbt0Fq8xCVUofeh/r7CKN4rbDrq4my6WYZpj+ZWaxE8CZ8uO/fXLUf5nt8IZHPXC 4DSpwrL0Obj1LU/7szeLTfBXF1ru4DChKrM2HN7GbGt++fti588ECdG3h6VgXhzNMCG3 eICSKSkcIKgxU83QqmfDnHmC06zGAspmg90PkW2k1vwFqyUMrNG02jUfMAz402q6NWvb XWXxbFe3sjjRAw9gaImRPmRc+tPBKY9/yX/7ufemXqPQhT2vvAThlScVgRVxgb9Om7ce df3w== X-Received: by 10.194.23.106 with SMTP id l10mr28479155wjf.1.1435568702905; Mon, 29 Jun 2015 02:05:02 -0700 (PDT) Received: from [10.3.255.188] (pir44-4-88-177-221-225.fbx.proxad.net. [88.177.221.225]) by mx.google.com with ESMTPSA id e4sm16161410wjy.46.2015.06.29.02.05.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2015 02:05:02 -0700 (PDT) Subject: Re: pg_xlog on a hot_stanby slave To: pgsql-general@postgresql.org References: <5581208E.7010205@gmail.com> <5582706D.9070100@gmail.com> From: Xavier 12 Message-ID: <55910A3C.6060404@gmail.com> Date: Mon, 29 Jun 2015 11:05:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------050600070202030801000604" X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org This is a multi-part message in MIME format. --------------050600070202030801000604 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 19/06/2015 03:31, Sameer Kumar wrote: > > On Thu, 18 Jun 2015 15:17 Xavier 12 > wrote: > > On 18/06/2015 04:00, Sameer Kumar wrote: > > > > On Wed, 17 Jun 2015 15:24 Xavier 12 > wrote: > > > On 17/06/2015 03:17, Sameer Kumar wrote: > > > On Tue, 16 Jun 2015 16:55 Xavier 12 > > wrote: > > Hi everyone, > > Questions about pg_xlogs again... > I have two Postgresql 9.1 servers in a > master/slave stream replication > (hot_standby). > > Psql01 (master) is backuped with Barman and > pg_xlogs is correctly > purged (archive_command is used). > > Hower, Psql02 (slave) has a huge pg_xlog (951 > files, 15G for 7 days > only, it keeps growing up until disk space is > full). I have found > documentation and tutorials, mailing list, but I > don't know what is > suitable for a Slave. Leads I've found : > > - checkpoints > - archive_command > - archive_cleanup > > Master postgresq.conf : > > [...] > wal_level = 'hot_standby' > archive_mode = on > archive_command = 'rsync -az > /var/lib/postgresql/9.1/main/pg_xlog/%f > barman@nas.lan:/data/pgbarman/psql01/incoming/%f > ' > max_wal_senders = 5 > wal_keep_segments = 64 > > What's this parameter's value on Slave? > > Hm... You have a point. > That autovacuum parameter seems to be useless on a slave. > I'll try to remove it and check pg_xlog. > > > > That was not my point. I was actually asking about > wal_keep_segment. Nevermind I found that I had misses the info > (found it below. Please see my response). > Besides I try to keep my master and standby config as same as > possible(so my advise ia to not switchoff autovacuum). The > parameters which are imeffective on slave anyways won't have > an effect. Same goes for parameters on master. > This helps me when I swap roles or do a failover. I have less > parameters to be worried about. > > > Okay > > > Can you check the pg_log for log files. They may have se info? > I am sorry if you have already provided that info (after I > finish I will try to look at your previous emails on this thread) > > > Nothing... > /var/log/postgresql/postgresql-2015-06-17_111131.log is empty > (except old messages at the begining related to a configuration > issue - which is now solved - after rebuilding the cluster yesterday). > /var/log/syslog has nothing but these : > > Jun 18 09:10:11 Bdd02 postgres[28400]: [2-1] 2015-06-18 09:10:11 > CEST LOG: paquet de d?marrage incomplet > Jun 18 09:10:41 Bdd02 postgres[28523]: [2-1] 2015-06-18 09:10:41 > CEST LOG: paquet de d?marrage incomplet > Jun 18 09:11:11 Bdd02 postgres[28557]: [2-1] 2015-06-18 09:11:11 > CEST LOG: paquet de d?marrage incomplet > Jun 18 09:11:41 Bdd02 postgres[28652]: [2-1] 2015-06-18 09:11:41 > CEST LOG: paquet de d?marrage incomplet > Jun 18 09:12:11 Bdd02 postgres[28752]: [2-1] 2015-06-18 09:12:11 > CEST LOG: paquet de d?marrage incomplet > Jun 18 09:12:41 Bdd02 postgres[28862]: [2-1] 2015-06-18 09:12:41 > CEST LOG: paquet de d?marrage incomplet > Jun 18 09:13:11 Bdd02 postgres[28891]: [2-1] 2015-06-18 09:13:11 > CEST LOG: paquet de d?marrage incomplet > Jun 18 09:13:40 Bdd02 postgres[28987]: [2-1] 2015-06-18 09:13:40 > CEST LOG: paquet de d?marrage incomplet > > These messages are related to Zabbix (psql port check). > > > You sure these are the only messages you have in the log files? > > > Also can you share the vacuum cost parameters in your environm > > en > > t? > > > > I don't understand that part... is this in postgresql.conf ? > > There are vacuum cost parameters in postgresql.conf > > http://www.postgresql.org/docs/9.4/static/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-VACUUM-COST > > > > autovacuum = on > > Slave postgresql.conf : > > [...] > wal_level = minimal > wal_keep_segments = 32 > > > > Sorry I missed this somehow earlier. Any reason why you think > you need to retain 32 wal files on slave? > > > No but I get the feeling that the parameter is ignored by my > slave... should I try another value ? > > > > > AFAIK you don't nees this parameter to set to > 0 unless you have > cascaded replica pull wal from stand by or you have backup jobs > running to backup from standby. Set it to 0 on the standby and check. > > > > hot_standby = on > > Slave recovery.conf : > > standby_mode = 'on' > primary_conninfo = 'host=10.0.0.1 port=5400 > user=postgres' > trigger_file = '/var/lib/postgresql/9.1/triggersql' > restore_command='cp > /var/lib/postgresql/9.1/wal_archive/%f "%p"' > archive_cleanup_command = > '/usr/lib/postgresql/9.1/bin/pg_archivecleanup > /var/lib/postgresql/9.1/wal_archive/ %r' > > > > Also consider setting hot_standby_feesback to on. > > > I will check that parameter in the documentation, > > Thanks > > > How can I reduce the number of WAL files on the > hot_stanby slave ? > > > Hello What happens if archive_command is stuck ? This happens in my Primary server because the remote SSH has timeouts sometimes. So I can see rsync process during a long time in the primary. Maybe this is the reason why WAL rotation is bad on the server. Regards, Xavier C. --------------050600070202030801000604 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

On 19/06/2015 03:31, Sameer Kumar wrote:

On Thu, 18 Jun 2015 15:17 Xavier 12 <maniatux@gmail.com> wrote:

On 18/06/2015 04:00, Sameer Kumar wrote:



On Wed, 17 Jun 2015 15:24 Xavier 12 <maniatux@gmail.com> wrote:


On 17/06/2015 03:17, Sameer Kumar wrote:


On Tue, 16 Jun 2015 16:55 Xavier 12 <maniatux@gmail.com> wrote:

Hi everyone,

Questions about pg_xlogs again...
I have two Postgresql 9.1 servers in a master/slave stream replication
(hot_standby).

Psql01 (master) is backuped with Barman and pg_xlogs is correctly
purged (archive_command is used).

Hower, Psql02 (slave) has a huge pg_xlog (951 files, 15G for 7 days
only, it keeps growing up until disk space is full). I have found
documentation and tutorials, mailing list, but I don't know what is
suitable for a Slave. Leads I've found :

- checkpoints
- archive_command
- archive_cleanup

Master postgresq.conf :

[...]
wal_level = 'hot_standby'
archive_mode = on
archive_command = 'rsync -az /var/lib/postgresql/9.1/main/pg_xlog/%f
barman@nas.lan:/data/pgbarman/psql01/incoming/%f'
max_wal_senders = 5
wal_keep_segments = 64

What's this parameter's value on Slave?

Hm... You have a point.
That autovacuum parameter seems to be useless on a slave.
I'll try to remove it and check pg_xlog.



That was not my point. I was actually asking about wal_keep_segment. Nevermind I found that I had misses the info (found it below. Please see my response).
Besides I try to keep my master and standby config as same as possible(so my advise ia to not switchoff autovacuum). The parameters which are imeffective on slave anyways won't have an effect. Same goes for parameters on master.
This helps me when I swap roles or do a failover. I have less parameters to be worried about.


Okay


Can you check the pg_log for log files. They may have se info? I am sorry if you have already provided that info (after I finish I will try to look at your previous emails on this thread)


Nothing...
/var/log/postgresql/postgresql-2015-06-17_111131.log is empty (except old messages at the begining related to a configuration issue - which is now solved - after rebuilding the cluster yesterday).
/var/log/syslog has nothing but these :

Jun 18 09:10:11 Bdd02 postgres[28400]: [2-1] 2015-06-18 09:10:11 CEST LOG:  paquet de d?marrage incomplet
Jun 18 09:10:41 Bdd02 postgres[28523]: [2-1] 2015-06-18 09:10:41 CEST LOG:  paquet de d?marrage incomplet
Jun 18 09:11:11 Bdd02 postgres[28557]: [2-1] 2015-06-18 09:11:11 CEST LOG:  paquet de d?marrage incomplet
Jun 18 09:11:41 Bdd02 postgres[28652]: [2-1] 2015-06-18 09:11:41 CEST LOG:  paquet de d?marrage incomplet
Jun 18 09:12:11 Bdd02 postgres[28752]: [2-1] 2015-06-18 09:12:11 CEST LOG:  paquet de d?marrage incomplet
Jun 18 09:12:41 Bdd02 postgres[28862]: [2-1] 2015-06-18 09:12:41 CEST LOG:  paquet de d?marrage incomplet
Jun 18 09:13:11 Bdd02 postgres[28891]: [2-1] 2015-06-18 09:13:11 CEST LOG:  paquet de d?marrage incomplet
Jun 18 09:13:40 Bdd02 postgres[28987]: [2-1] 2015-06-18 09:13:40 CEST LOG:  paquet de d?marrage incomplet

These messages are related to Zabbix (psql port check).


You sure these are the only messages you have in the log files?


Also can you share the vacuum cost parameters in your environm

en

t?



I don't understand that part... is this in postgresql.conf ?

There are vacuum cost parameters in postgresql.conf

http://www.postgresql.org/docs/9.4/static/runtime-config-resource.html#RUNTIME-CONFIG-RESOURCE-VACUUM-COST



autovacuum = on

Slave postgresql.conf :

[...]
wal_level = minimal
wal_keep_segments = 32



Sorry I missed this somehow earlier. Any reason why you think you need to retain 32 wal files on slave?


No but I get the feeling that the parameter is ignored by my slave... should I try another value ?




AFAIK you don't nees this parameter to set to > 0 unless you have cascaded replica pull wal from stand by or you have backup jobs running to backup from standby. Set it to 0 on the standby and check.



hot_standby = on

Slave recovery.conf :

standby_mode = 'on'
primary_conninfo = 'host=10.0.0.1 port=5400 user=postgres'
trigger_file = '/var/lib/postgresql/9.1/triggersql'
restore_command='cp /var/lib/postgresql/9.1/wal_archive/%f "%p"'
archive_cleanup_command =
'/usr/lib/postgresql/9.1/bin/pg_archivecleanup
/var/lib/postgresql/9.1/wal_archive/ %r'



Also consider setting hot_standby_feesback to on.


I will check that parameter in the documentation,

Thanks


How can I reduce the number of WAL files on the hot_stanby slave ?




Hello
What happens if archive_command is stuck ? This happens in my Primary server because the remote SSH has timeouts sometimes. So I can see rsync process during a long time in the primary.
Maybe this is the reason why WAL rotation is bad on the server.

Regards,
Xavier C.
--------------050600070202030801000604--