Subject: Issues with systemd unit file for repmgr

From: Simon Oxwell <[email-masked]>
Date: Mon, 29 Jun 2015 14:00:25 +1000

Hi,

Firstly, I'd like to thank the team for the hard work done in packaging
Postgresql and all the associated ecosystem. It's great stuff and had
saved me heaps of time in the last couple of weeks.

That said, I am having trouble with the systemd unit file for repmgrd
[1]. I'm using the repmgr94 package, version 3.0.1-1 on CentOS7 (so the
RHEL7 flavour). It basically doesn't work, due to a misplaced quote mark
and a kill command that seems to have an issue.

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?

Thanks,

Simon
[1]
http://git.postgresql.org/gitweb/?p=pgrpms.git;a=blob;f=rpm/redhat/9.4/repmgr/EL-7/repmgr-9.4.service

-- 
Simon Oxwell | Hosting Team

Funnelback
P: +61 2 6176 3170 | F: +61 2 6230 7313
[email-masked]  | www.funnelback.com
A: Ground Floor, 51 Allara Street, Civic, Canberra 2601

-- 
Sent via pgsql-pkg-yum mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-pkg-yum

---

From: Devrim GÜNDÜZ <[email-masked]>
Date: Sun, 05 Jul 2015 17:56:00 +0300

Hi,

> saved me heaps of time in the last couple of weeks.

You are welcome!

> [1]. I'm using the repmgr94 package, version 3.0.1-1 on CentOS7 (so 
> the RHEL7 flavour). It basically doesn't work, due to a misplaced 
> quote mark and a kill command that seems to have an issue.

:-(

> 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.

Regards,
-- 
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

---

From: Simon Oxwell <[email-masked]>
Date: Tue, 14 Jul 2015 16:04:17 +1000

> 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