Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kG1ss-0003Wv-3R for pgsql-general@arkaria.postgresql.org; Wed, 09 Sep 2020 15:19:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kG1sr-0003Fp-2C for pgsql-general@arkaria.postgresql.org; Wed, 09 Sep 2020 15:19:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kG1sq-0003FQ-DM for pgsql-general@lists.postgresql.org; Wed, 09 Sep 2020 15:19:40 +0000 Received: from mail.dalibo.com ([212.85.157.172]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kG1sl-0004HL-Jj for pgsql-general@postgresql.org; Wed, 09 Sep 2020 15:19:39 +0000 Received: from firost (larco.ioguix.net [82.66.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id A28F62047E; Wed, 9 Sep 2020 17:19:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1599664772; bh=ipST1duWxuCHyd0ST5iUjkh+gwfadD+dI6Ej4Kd9CCA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SV1wb3oCQWhaYHk3VC1kS8fVFO7Sek8tbS5MpCxC28FA/4GiBuUfLxXoNo0NRXzdp 41Z9RUfZNwZ3TYFWuGPvQqq0rlldaL/783mY39QdCPbBG+C3mnwATb5wY9vIAYw7W7 mQsKrYqbwkvxyGS/vZ7F6hlwq2sm2/wfPGKCvSJw= Date: Wed, 9 Sep 2020 17:19:31 +0200 From: Jehan-Guillaume de Rorthais To: =?UTF-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= Cc: pgsql-general Subject: Re: BUG? Slave don't reconnect to the master Message-ID: <20200909171931.64fce7bb@firost> In-Reply-To: <8323CF21-D316-4529-BFC3-77C97F8E341B@ya.ru> References: <60590EC6-4062-4F25-A49C-3948ED2A7D47@ya.ru> <20200819150713.326c3532@firost> <52BADD0F-E348-43BB-8992-FDE86F3B1A65@ya.ru> <20200821162642.4245add6@firost> <253962B4-CB29-4A90-A995-17B6047D3876@ya.ru> <20200903133915.1850e955@firost> <8323CF21-D316-4529-BFC3-77C97F8E341B@ya.ru> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 7 Sep 2020 23:46:17 +0300 =D0=9E=D0=BB=D0=B5=D0=B3 =D0=A1=D0=B0=D0=BC=D0=BE=D0=B9=D0=BB=D0=BE=D0=B2 <= splarv@ya.ru> wrote: > [...] =20 > >>> why did you add "monitor interval=3D15"? No harm, but it is redundant= with > >>> "monitor interval=3D16 role=3DMaster" and "monitor interval=3D17 > >>> role=3DSlave". =20 > >>=20 > >> I can't remember clearly. :) Look what happens without it. > >>=20 > >> + pcs -f configured_cib.xml resource create krogan2DB ocf:heartbeat:pg= sqlms > >> bindir=3D/usr/pgsql-11/bin pgdata=3D/var/lib/pgsql/krogan2 > >> recovery_template=3D/var/lib/pgsql/krogan2.paf meta master notify=3Dtr= ue > >> resource-stickiness=3D10 > >> Warning: changing a monitor operation interval from 15 to 16 to make t= he > >> operation unique > >> Warning: changing a monitor operation interval from 16 to 17 to make t= he > >> operation unique =20 > >=20 > > Something fishy here. This command lack op monitor settings. Pacemaker = don't > > add any default monitor operation with default interval if you don't gi= ve > > one at resource creation. > >=20 > > If you create such a resource with no monitoring, the cluster will > > start/stop it when needed, but will NOT check for its health. See:=20 > >=20 > > https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html/Pacemake= r_Explained/s-resource-monitoring.html =20 >=20 > May be. But keep in mind, that I uses `pcs`, I do not edit the xml file > directly. And I use too old pacemaker, the default package of CentOS 7 is > pacemaker-1.1.21-4.el7.x86_64, while you link of documentation is for > Pacemaker 2.0. It's the same behavior between both 2.0 and 1.1, but ...(see bellow) > >> So trivial monitor always exists by default with interval 15. =20 > >=20 > > nope. =20 >=20 > This is not true for CentOS 7. I removed my monitor options, for this exa= mple. >=20 > pcs cluster cib original_cib.xml > cp original_cib.xml configured_cib.xml > pcs -f configured_cib.xml resource create krogan3DB ocf:heartbeat:pgsqlms > bindir=3D/usr/pgsql-11/bin pgdata=3D/var/lib/pgsql/krogan3 > recovery_template=3D/var/lib/pgsql/krogan3.paf meta master notify=3Dtrue > resource-stickiness=3D10 I tried your command, and indeed, pcs creates the missing monitor operation with a default interval of 15. This is surprising, it's the first time I cr= oss these warning messages. Thanks for this information, I wasn't aware of this= pcs behavior. But anyway, it's not recommended to create your resources without specifying interval and timeout for each operations. See PAF docs. Just create the two monitor operations related to both roles and you'll not have these warnings. > > [...] > > OK, I understand now. If you want to edit an existing resource, use "pcs > > resource update". Make sure read the pcs manual about how to use it to > > edit/remove/add operations on a resource. =20 >=20 > This is not so easy. To edit existed resource I must to know the "interva= l" > of this resource, but in this case I am not sure what the interval will be > for the monitor operation of the master role. :) Because > >>=20 > >> Warning: changing a monitor operation interval from 15 to 16 to make t= he > >> operation unique > >> Warning: changing a monitor operation interval from 16 to 17 to make t= he > >> operation unique =20 >=20 > I am not sure in what order and what it will be. Thats why I configured a= s I > configured. This just works. Now we know where these warnings comes from, you have a solution (set both of them explicitly) > >> Looked like the default timeout 10 was not enough for the "master". =20 > >=20 > > It's written in PAF doc. See: > > https://clusterlabs.github.io/PAF/configuration.html#resource-agent-act= ions > >=20 > > Do not hesitate to report or submit some enhancements to the doc if > > needed. =20 >=20 > May be the documentation was improved. Thanks that you have pointed me on > that. After moving to CentOS 8 I will check with recommended parameters > according to the documentation.=20 You can do it right now with CentOS 7. They are the same. > > [...] > >>>> 10:30:55.965 FATAL: terminating walreceiver process dpue to > >>>> administrator cmd 10:30:55.966 LOG: redo done at 0/1600C4B0 > >>>> 10:30:55.966 LOG: last completed transaction was at log time > >>>> 10:25:38.76429 10:30:55.968 LOG: selected new timeline ID: 4 > >>>> 10:30:56.001 LOG: archive recovery complete > >>>> 10:30:56.005 LOG: database system is ready to accept connections = =20 > >>> =20 > >>>> The slave with didn't reconnected replication, tuchanka3c. Also I > >>>> separated logs copied from the old master by a blank line: > >>>>=20 > >>>> [...] > >>>>=20 > >>>> 10:20:25.168 LOG: database system was interrupted; last known up at > >>>> 10:20:19 10:20:25.180 LOG: entering standby mode > >>>> 10:20:25.181 LOG: redo starts at 0/11000098 > >>>> 10:20:25.183 LOG: consistent recovery state reached at 0/11000A68 > >>>> 10:20:25.183 LOG: database system is ready to accept read only > >>>> connections 10:20:25.193 LOG: started streaming WAL from primary at > >>>> 0/12000000 on tl 3 10:25:05.370 LOG: could not send data to client: > >>>> Connection reset by peer 10:26:38.655 FATAL: terminating walreceiver > >>>> due to timeout 10:26:38.655 LOG: record with incorrect prev-link > >>>> 0/1200C4B0 at 0/1600C4D8 =20 > >>>=20 > >>> This message appear before the effective promotion of tuchanka3b. Do = you > >>> have logs about what happen *after* the promotion? =20 > >>=20 > >> This is end of the slave log. Nothing. Just absent replication. =20 > >=20 > > This is unusual. Could you log some more details about replication > > tryouts to your PostgreSQL logs? Set log_replication_commands and lower > > log_min_messages to debug ? =20 >=20 > Sure, this is PostgreSQL logs for the cluster tuchanka3. > Tuchanka3a is an old (failed) master. According to your logs: 20:29:41 tuchanka3a: freeze 20:30:39 tuchanka3c: wal receiver timeout (default 60s timeout) 20:30:39 tuchanka3c: switched to archives, and error'ed (expected) 20:30:39 tuchanka3c: switched to stream again (expected) no more news from this new wal receiver=20 20:34:21 tuchanka3b: promoted I'm not sure where your floating IP is located at 20:30:39, but I suppose it is still on tuchanka3a as the wal receiver don't hit any connection error a= nd tuchanka3b is not promoted yet. So at this point, I suppose the wal receiver is stuck in libpqrcv_connect waiting for frozen tuchanka3a to answer, with no connection timeout. You mi= ght track tcp sockets on tuchanka3a to confirm this. To avoid such a wait, try to add eg. connect_timeout=3D2 to your primary_co= nninfo parameter. See: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWO= RDS Regards,