EnterpriseDB/repmgr

systemd fails to start repmgrd daemon

Closed this issue · 2 comments

With Centos 7, PG 12.2, repmgr 5.1, systemd does not start the repmgrd daemon. It is trying to start it using the default pid file, /run/repmgr/repmgr-12.pid. This is defined in the repmgr service file, /usr/lib/systemd/system/repmgr12.service.

Fix: create the /run/repmgr directory and give the proper ownership to it. Since I use postgres user to do repmgr commands:

sudo su -
cd /run
mkdir repmgr
chown postgres:postgres -R repmgr

Now the normal systemd command works:
systemctl start repmgr12.service

Hi

Which repository did you install the repmgr package (presumably repmgr12) from? yum list repmgr12 will show this.

It does look like the repmgr12 package from the community (PGDG) repository isn't creating the /run/repmgr directory, which is clearly a bug (even though it appears to be specified in the manifest) ; I'll check further and raise a ticket there.

The package provided by 2ndQuadrant do create /run/repmgr:

[root@node1 ~]# ls -ld /run/repmgr
ls: cannot access /run/repmgr: No such file or directory
[root@node1 ~]# yum install -y https://dl.2ndquadrant.com/default/release/browse/rpm/packages/rhel/7/x86_64/12/repmgr12-5.1.0-1.el7.x86_64.rpm
Loaded plugins: fastestmirror
repmgr12-5.1.0-1.el7.x86_64.rpm                                | 260 kB  00:00:00     
Examining /var/tmp/yum-root-Sax_UD/repmgr12-5.1.0-1.el7.x86_64.rpm: repmgr12-5.1.0-1.el7.x86_64
Marking /var/tmp/yum-root-Sax_UD/repmgr12-5.1.0-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package repmgr12.x86_64 0:5.1.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================
 Package       Arch        Version            Repository                         Size
======================================================================================
Installing:
 repmgr12      x86_64      5.1.0-1.el7        /repmgr12-5.1.0-1.el7.x86_64      1.1 M

Transaction Summary
======================================================================================
Install  1 Package

Total size: 1.1 M
Installed size: 1.1 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : repmgr12-5.1.0-1.el7.x86_64                                        1/1 
  Verifying  : repmgr12-5.1.0-1.el7.x86_64                                        1/1 

Installed:
  repmgr12.x86_64 0:5.1.0-1.el7                                                       

Complete!
[root@node1 ~]# ls -ld /run/repmgr
drwxr-xr-x. 2 postgres postgres 40 May  8 02:13 /run/repmgr

As a workaround we suggest using the 2ndQuadrant repositories; for details see here: https://repmgr.org/docs/current/installation-packages.html#INSTALLATION-PACKAGES-REDHAT

I installed two servers (master and standby) with same Community version (Centos 7, PG 12.2, repmgr 5.2), one server could create /run/repmgr directory and one server couldn't. I must manual create and change owner for postgres:postgres.