3

My setup has 2 Postgres hosts:

  • host SRV1 as primary with 2 instances and IP 192.168.1.241

    • Instance A listening on port 5432
    • Instance B listening on port 5433
  • host SRV2 as standby with instance C and IP 192.168.1.243 using default port.

I'd configured sucessfully replication from instace A to instance C using repmgr.

I'm using PostgreSQL 10 and rempgr 4.

How could I configure replication from new instances, e.g. B, to a new instance on host SRV2 (standby) using repmgr?

1 Answer 1

2

You can do that , just treat your instances as if they where separate nodes. In your case you will end up with 3 instances on the standby server.

In repmgr you will need to create a cluster for A, B and C. Let's call them CA, CB and CC, then you start by adding the nodes A and B and C as a primary node. Your layout on SRV2 will have to allow those instances to live next to eachother. Since you don't really mention what OS/flavor you are using it's hard to give specific advice there.

afaik you will most probably need to run several repmgr daemons if you use them in conjunction with different repmgr.conf config files which is probably the biggest hassle.

CORRECTIONS:

I seem to have misunderstood it a bit, you seem to have 2 clusters, with 4 instances (3 existing and 1 pending), Instances SRV1/A + SRV2/C make up cluster CA , then you just need to add instance D to cluster SRV1/B , making SRV1B + SRV2/D cluster number 2. In any case, you need 2 repmgr.conf files, I've checked the docs and it never talks about multiple cluster support. But nothing would stop you from running 2 repmgrd deamons with different config files.

2
  • I missed to mention OS, it's CentOS 7. I tried this approach additionally I've always setting PGDATA=/NEWinst/data and passing the new file in repmgr -f /etc/repmgr/10/repmgrNEWinst.conf ... commands. Everything worked! Thank you
    – Rogerlr
    Jun 13, 2018 at 19:28
  • Welcome, no problem, I happen to have been setting this up very recently as well on RHEL7 , Make sure you use absolute paths in repmgr.conf on centOS, I've had an issue where the repmgr worked fine in handling switchovers etc but repmgrd didn't, and it all came back to not being able to find the executables in the *_command vars like follow_command. Took me a while to realize. Happy it works. btw, I have an nice haproxy config tool that might help you balancing your nodes automatically See github.com/gplv2/haproxy-postgresql
    – Glenn Plas
    Jun 14, 2018 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.