Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBFr5-0006ZJ-KE for pgsql-general@arkaria.postgresql.org; Wed, 25 Apr 2018 08:32:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fBFr4-0001Fz-DE for pgsql-general@arkaria.postgresql.org; Wed, 25 Apr 2018 08:32:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBFr3-0001Fp-W3 for pgsql-general@lists.postgresql.org; Wed, 25 Apr 2018 08:32:46 +0000 Received: from mimolette.dalibo.net ([212.85.157.144] helo=mail.dalibo.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBFqv-0005Pl-69 for pgsql-general@postgresql.org; Wed, 25 Apr 2018 08:32:44 +0000 Received: from firost (228.169.9.109.rev.sfr.net [109.9.169.228]) by mail.dalibo.com (Postfix) with ESMTPSA id 55E7F2C0C46; Wed, 25 Apr 2018 10:32:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1524645153; bh=X13utx3dPlFKXKWtBuW/kNQLESdDQZOraQtTV42fCB8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KSD5HKdhvR8murtWusta6S08bP9XVHYryWcBB+n3gaNheih58tXaNPJQtKdC+9dIp Yu+PuP5oCrzEQo8OFnUZ2lHtNLrsl3ECxOdoebxInz3gjcnyxfOr6nluVGhzZIaCGf 4wJrYAjoh77hzmlrUwDiOHl1xkxF86KiijqIdKv0= Date: Wed, 25 Apr 2018 10:32:32 +0200 From: Jehan-Guillaume de Rorthais To: =?UTF-8?B?6IyD5Zu96IW+?= Cc: Cluster Labs - All topics related to open-source clustering welcomed , Adrien Nayrat , "Andrew Edenburn" , "pgsql-general@postgresql.org" Subject: Re: [ClusterLabs] =?UTF-8?B?562U5aSNOiAg562U5aSNOg==?= Postgres PAF setup Message-ID: <20180425103232.00dc77e8@firost> In-Reply-To: References: <21a601ab-d103-d17e-7d2d-ad7d960d5bd1@anayrat.info> <7d6efeaed9624171b1ead214651ceea9@EX01.highgo.com> 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 You should definitely not patch the PAF source code without opening an issu= e on github and discuss your changes. As Adrien explained, your changes could greatly end up with an instance corruption or data loss. On Wed, 25 Apr 2018 07:45:55 +0000 =E8=8C=83=E5=9B=BD=E8=85=BE wrote: ... > Is there any way to make the cluster recover if the postgres was not prop= erly > stopped, such as the lab power off or the OS reboot? Os graceful reboot is supposed to be a clean shutdown, you should not have trouble with PostgreSQL. For real failure scenarios, you must: * put your cluster in maintenance mode * fix your PostgreSQL setup and replication * make sure PostgreSQL is replicating correctly * make sure to keep the master where the cluster is waiting for it if needed * make sure to stop your postgresql instances if the cluster is considering= it is stopped * switch off maintenance mode * you might need to start your resource if the cluster kept it stopped. You can find documentation here and in other pages around: https://clusterlabs.github.io/PAF/administration.html > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: Adrien Nayrat [mailto:adrien.nayrat@anayrat.= info]=20 > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2018=E5=B9=B44=E6=9C=8825=E6=97=A5 = 15:29 > =E6=94=B6=E4=BB=B6=E4=BA=BA: Cluster Labs - All topics related to open-so= urce clustering welcomed > ; =E8=8C=83=E5=9B=BD=E8=85=BE ; Andrew Edenburn > ; pgsql-general@postgresql.org =E4=B8=BB=E9=A2=98= : Re: > [ClusterLabs] =E7=AD=94=E5=A4=8D: Postgres PAF setup >=20 > On 04/25/2018 02:31 AM, =E8=8C=83=E5=9B=BD=E8=85=BE wrote: > > I have meet the similar issue when the postgres is not stopped normally= .=20 > > =20 > > You could run pg_controldata to check if your postgres status is > > shutdown/shutdown in recovery. > >=20 > > I change the /usr/lib/ocf/resource.d/heartbeat/pgsqlms to avoid this > > problem: > >=20 > > elsif ( $pgisready_rc =3D=3D 2 ) { > > # The instance is not listening. > > # We check the process status using pg_ctl status and check # if it=20 > > was propertly shut down using pg_controldata. > > ocf_log( 'debug', 'pgsql_monitor: instance "%s" is not listening',=20 > > $OCF_RESOURCE_INSTANCE ); > > # return _confirm_stopped(); # remove this line > > return $OCF_NOT_RUNNING; > > } =20 >=20 > Hello, >=20 > It is a bad idea. The goal of _confirm_stopped is to check if the instance > was properly stopped. If it wasn't you could corrupt your instance. >=20 > _confirm_stopped return $OCF_NOT_RUNNING only if the instance was proper= ly > shutdown : elsif ( $controldata_rc =3D=3D $OCF_NOT_RUNNING ) { > # The controldata state is consistent, the instance was probably > # propertly shut down. > ocf_log( 'debug', > '_confirm_stopped: instance "%s" controldata indicates that t= he > instance was propertly shut down', $OCF_RESOURCE_INSTANCE ); > return $OCF_NOT_RUNNING; > } >=20 > Regards, >=20 >=20 > -- > Adrien NAYRAT >=20 >=20 > _______________________________________________ > Users mailing list: Users@clusterlabs.org > https://lists.clusterlabs.org/mailman/listinfo/users >=20 > Project Home: http://www.clusterlabs.org > Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf > Bugs: http://bugs.clusterlabs.org --=20 Jehan-Guillaume de Rorthais Dalibo