Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZEtKN-00031B-V0 for pgsql-pkg-yum@arkaria.postgresql.org; Tue, 14 Jul 2015 06:04:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZEtKM-00059J-S6 for pgsql-pkg-yum@arkaria.postgresql.org; Tue, 14 Jul 2015 06:04:26 +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.84) (envelope-from ) id 1ZEtKM-00059C-Ff for pgsql-pkg-yum@postgresql.org; Tue, 14 Jul 2015 06:04:26 +0000 Received: from smtp96.ord1c.emailsrvr.com ([108.166.43.96]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZEtKI-00029X-7F for pgsql-pkg-yum@postgresql.org; Tue, 14 Jul 2015 06:04:24 +0000 Received: from smtp13.relay.ord1c.emailsrvr.com (localhost.localdomain [127.0.0.1]) by smtp13.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 0FC23380113; Tue, 14 Jul 2015 02:04:21 -0400 (EDT) Received: by smtp13.relay.ord1c.emailsrvr.com (Authenticated sender: soxwell-AT-funnelback.com) with ESMTPSA id D394F3800EA; Tue, 14 Jul 2015 02:04:19 -0400 (EDT) X-Sender-Id: soxwell@funnelback.com Received: from simon-oxwells-macbook-pro.local (canb-fw01.squiz.net [103.15.168.1]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA) by 0.0.0.0:465 (trex/5.4.2); Tue, 14 Jul 2015 06:04:21 GMT Message-ID: <55A4A661.1080204@funnelback.com> Date: Tue, 14 Jul 2015 16:04:17 +1000 From: Simon Oxwell User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: =?UTF-8?B?RGV2cmltIEfDnE5Ew5xa?= , pgsql-pkg-yum@postgresql.org CC: saas Subject: Re: Issues with systemd unit file for repmgr References: <5590C2D9.1040602@funnelback.com> <1436108160.17365.10.camel@gunduz.org> In-Reply-To: <1436108160.17365.10.camel@gunduz.org> Content-Type: multipart/mixed; boundary="------------050700000407080606010004" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-pkg-yum Precedence: bulk Sender: pgsql-pkg-yum-owner@postgresql.org This is a multi-part message in MIME format. --------------050700000407080606010004 Content-Type: multipart/alternative; boundary="------------080403000907010300030209" --------------080403000907010300030209 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6/07/2015 12:56 am, Devrim G=C3=9CND=C3=9CZ wrote: >> After a bit of hacking, I've got a version that's working and is a >> little more flexible with some some of the extra command line options=20 >> of repmgrd. What's the best way of sharing it back to team? As a=20 >> patch file or as a pull request? > You can do both, I personally prefer the patch in the mailing list. > > Hi Devrim, I also ran into problems with repmgrd running as the repmgr user that gets created in the specfile. It was unable to promote the standby database to a master, because it wasn't running at the postgres user. All the of the examples that are part of the documentation for repmgr specify running them as the postgres user. As a result my unit file runs repmgrd as postgres. I did have to chown /var/log/repmgr to be owned by postgres:postgres as the specfile creates it as repmgr:repmgr. Other changes: * moved most of the environment variables out to a sysconfig file (/etc/sysconfig/repmgr94). This let me change options as well, rather than having to edit the unit file. Much easier to be able to manipulate with something like puppet, and can be sourced by the SysV init script as well. * used a PIDFile directive. This unfortunately required hardcoding the location of the PID file twice in the unit file, as PIDFile only takes an absolute pathname or it throws an error. Without this, systemd can't seem to guess the PID correctly when it comes to shutting down. Hope this is of use. The other issue I have is that repmgr can't actually parse the sample config file that the package makes the default config file, but I'm working on a patch to submit to 2nd Quadrant for that. (Just for reference, I'm using the repmgr94 package with Postgresql94) Thanks, Simon --------------080403000907010300030209 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 6/07/2015 12:56 am, Devrim GÜNDÜZ wrote:
After a bit of hacking, I've got a version that's working and is a
little more flexible with some some of the extra command line options 
of repmgrd. What's the best way of sharing it back to team? As a 
patch file or as a pull request?
You can do both, I personally prefer the patch in the mailing list.


Hi Devrim,

I also ran into problems with repmgrd running as the repmgr user that gets created in the specfile. It was unable to promote the standby database to a master, because it wasn't running at the postgres user. All the of the examples that are part of the documentation for repmgr specify running them as the postgres user.

As a result my unit file runs repmgrd as postgres. I did have to chown /var/log/repmgr to be owned by postgres:postgres as the specfile creates it as repmgr:repmgr.

Other changes:
  • moved most of the environment variables out to a sysconfig file (/etc/sysconfig/repmgr94). This let me change options as well, rather than having to edit the unit file. Much easier to be able to manipulate with something like puppet, and can be sourced by the SysV init script as well.
  • used a PIDFile directive. This unfortunately required hardcoding the location of the PID file twice in the unit file, as PIDFile only takes an absolute pathname or it throws an error. Without this, systemd can't seem to guess the PID correctly when it comes to shutting down.

Hope this is of use.

The other issue I have is that repmgr can't actually parse the sample config file that the package makes the default config file, but I'm working on a patch to submit to 2nd Quadrant for that.

(Just for reference, I'm using the repmgr94 package with Postgresql94)


Thanks,

Simon

--------------080403000907010300030209-- --------------050700000407080606010004 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="repmgr94" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="repmgr94" IyBDb25maWd1cmF0aW9uIGZpbGUgZm9yIHJlcG1ncmQKCiMgTG9jYXRpb24g b2YgdGhlIHJlcG1nciBjb25maWcgZmlsZQpSRVBNR1JEQ09ORj0vZXRjL3Jl cG1nci85LjQvcmVwbWdyLmNvbmYKCiMgTG9jYXRpb24gb2YgdGhlIHJlbXBn cmQgbG9nIGZpbGUKUkVQTUdSRExPRz0vdmFyL2xvZy9yZXBtZ3IvcmVwbWdy ZC05LjQubG9nCgojIHJlcG1ncmQgb3B0aW9ucyAoZWcgLS1tb25pdG9yaW5n LWhpc3RvcnksIC0tdmVyYm9zZSkKUkVQTUdST1BUUz0iIgo= --------------050700000407080606010004 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="repmgr94.service" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="repmgr94.service" IyBJdCdzIG5vdCByZWNvbW1lbmRlZCB0byBtb2RpZnkgdGhpcyBmaWxlIGlu LXBsYWNlLCBiZWNhdXNlIGl0IHdpbGwgYmUKIyBvdmVyd3JpdHRlbiBkdXJp bmcgcGFja2FnZSB1cGdyYWRlcy4gIElmIHlvdSB3YW50IHRvIGN1c3RvbWl6 ZSwgdGhlCiMgYmVzdCB3YXkgaXMgdG8gY3JlYXRlIGEgZmlsZSAiL2V0Yy9z eXN0ZW1kL3N5c3RlbS9yZXBtZ3Iuc2VydmljZSIsCiMgY29udGFpbmluZwoj CS5pbmNsdWRlIC9saWIvc3lzdGVtZC9zeXN0ZW0vcmVwbWdyLnNlcnZpY2UK IwkuLi5tYWtlIHlvdXIgY2hhbmdlcyBoZXJlLi4uCiMgRm9yIG1vcmUgaW5m byBhYm91dCBjdXN0b20gdW5pdCBmaWxlcywgc2VlCiMgaHR0cDovL2ZlZG9y YXByb2plY3Qub3JnL3dpa2kvU3lzdGVtZCNIb3dfZG9fSV9jdXN0b21pemVf YV91bml0X2ZpbGUuMkZfYWRkX2FfY3VzdG9tX3VuaXRfZmlsZS4zRgoKW1Vu aXRdCkRlc2NyaXB0aW9uPUEgcmVwbGljYXRpb24gbWFuYWdlciwgYW5kIGZh aWxvdmVyIG1hbmFnZW1lbnQgdG9vbCBmb3IgUG9zdGdyZVNRTApBZnRlcj1z eXNsb2cudGFyZ2V0CkFmdGVyPW5ldHdvcmsudGFyZ2V0CgpbU2VydmljZV0K VHlwZT1mb3JraW5nCgpVc2VyPXBvc3RncmVzCkdyb3VwPXBvc3RncmVzCgpF bnZpcm9ubWVudEZpbGU9L2V0Yy9zeXNjb25maWcvcmVwbWdyOTQKUElERmls ZT0vdmFyL3J1bi9yZXBtZ3IvcmVwbWdyZC05LjQucGlkCgojIFdoZXJlIHRv IHNlbmQgZWFybHktc3RhcnR1cCBtZXNzYWdlcyBmcm9tIHRoZSBzZXJ2ZXIK IyBUaGlzIGlzIG5vcm1hbGx5IGNvbnRyb2xsZWQgYnkgdGhlIGdsb2JhbCBk ZWZhdWx0IHNldCBieSBzeXN0ZW1kCiMgU3RhbmRhcmRPdXRwdXQ9c3lzbG9n CkV4ZWNTdGFydD0vdXNyL3Bnc3FsLTkuNC9iaW4vcmVwbWdyZCAtZiAke1JF UE1HUkRDT05GfSAtcCAvdmFyL3J1bi9yZXBtZ3IvcmVwbWdyZC05LjQucGlk ICR7UkVQTUdST1BUU30gLWQgPiAke1JFUE1HUkRMT0d9IDI+JjEKRXhlY1N0 b3A9L3Vzci9iaW4va2lsbCAtVEVSTSAke01BSU5QSUR9CkV4ZWNSZWxvYWQ9 L3Vzci9iaW4va2lsbCAtSFVQICR7TUFJTlBJRH0KIyBHaXZlIGEgcmVhc29u YWJsZSBhbW91bnQgb2YgdGltZSBmb3IgdGhlIHNlcnZlciB0byBzdGFydCB1 cC9zaHV0IGRvd24KVGltZW91dFNlYz0zMDAKCltJbnN0YWxsXQpXYW50ZWRC eT1tdWx0aS11c2VyLnRhcmdldAo= --------------050700000407080606010004 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-pkg-yum mailing list (pgsql-pkg-yum@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-pkg-yum --------------050700000407080606010004--