HA Cluster Replication - PostgreSQL 12 + Repmgr12 + Pgbackrest

56 views
Skip to first unread message

Narayan Ubale

unread,
Jun 16, 2021, 3:23:40 PMJun 16
to repmgr
Hi, 

I am new to new to PG DB HA Cluster Replication and  Repmgr12.

I am running 1 Node Cluster with  PostgreSQL 12 + Pgbackrest. I want to improve the setup to HA Cluster Replication improve with 5 Node Cluster with  PostgreSQL 12 + Repmgr12 +  Pgbackrest.


  • I am having issues trying to get 'repmgr standby switchover and WAL archive management with 5 Node with Pgbackrest instead of cp/rsync/scp/barman' to work correctly from Wal Server?

  • Not sure about repmgr integration Pgbackrest. How to use restore_command do we need to configure inside repmgr.conf
    • restore_command = 'pgbackrest --stanza=v_pgdata archive-get %f "%p"

    • Do we need to use inside repmgr.conf  - barman_host='barman@barmanserver' and barman_server='pgnode' since I am not using Barman


I'm submitting my PostgreSQL.conf and repmgr.conf 

  • postgresql.conf

shared_preload_libraries = 'pg_stat_statements, repmgr'

wal_level = replica

max_wal_senders = 10

wal_log_hints = on


archive_mode = on

archive_command = 'pgbackrest --stanza=v_pgdata archive-push %p'


Verify archive_command  is correct or not?


  • repmgr.conf

promote_command = 'repmgr standby promote  --log-to-file'
follow_command = 'repmgr standby follow --log-to-file --upstream-node-id=%n'

restore_command = 'pgbackrest --stanza=v_pgdata archive-get %f "%p"'

barman_host='barman@barmansrv'
barman_server='pg'

Not Sure  restore_command  is correct or not ?

Do we need to use inside repmgr.conf  - barman_host='barman@barmanserver' and barman_server='pgnode' since I am not using Barman

Please help with above.

Thanks in advance


Ian Barwick

unread,
Jun 20, 2021, 9:04:54 PMJun 20
to rep...@googlegroups.com
On 17/06/2021 04:23, 'Narayan Ubale' via repmgr wrote:
> Hi,
>
> I am new to new to PG DB HA Cluster Replication and Repmgr12.
>
> I am running 1 *Node Cluster *with *PostgreSQL 12 + Pgbackrest. *I want to improve the setup to HA Cluster Replication improve with *5 Node Cluster *with *PostgreSQL 12 + Repmgr12 + Pgbackrest.*

Currently there is no explicit support for Pgbackrest in repmgr, so
we are unable to advise about Pgbackrest issues. However:


> * I am having issues trying to get '_repmgr standby switchover_ and *WAL *archive management with *5 Node* with *_Pgbackrest _*instead of *_cp/rsync/scp/barman_*' to work correctly from Wal Server?
>
>
> * Not sure about repmgr integration Pgbackrest. How to use*restore_command* do we need to configure inside *repmgr.conf* ?
> o restore_command = 'pgbackrest --stanza=v_pgdata archive-get %f "%p"/_
If included in "repmgr.conf", "restore_command" will added to the
PostgreSQL replication configuration by repmgr when setting up a standby.

Alternatively you can configure "restore_command" in PostgreSQL directly
(in which case it should be omitted from "repmgr.conf").


>
> o Do we need to use inside repmgr.conf - _/*barman_host*='barman@barmanserver' and *barman_server*='pgnode/_' since I am not using Barman

No; if you're not using Barman, Barman configuration is not needed in repmgr.

>
>
> I'm submitting my PostgreSQL.conf and repmgr.conf
>
> * *postgresql.conf*
>
> /shared_preload_libraries = 'pg_stat_statements, repmgr'/
>
> /wal_level = replica/
>
> /max_wal_senders = 10/
>
> /wal_log_hints = on/
>
> /
> /
>
> /archive_mode = on/
>
> /*archive_command *= 'pgbackrest --stanza=v_pgdata archive-push %p'/
>
>
> Verify /archive_command is correct or not*?*/

Try executing the command manually? If "pgbackrest" is not in one of
the usual paths ("/usr/bin" etc.), you may need to provide the full
path to the binary.

> *
>
> repmgr.conf
>
> /promote_command = 'repmgr standby promote --log-to-file'/
> /follow_command = 'repmgr standby follow --log-to-file --upstream-node-id=%n'/
> /
> /
> /restore_command = 'pgbackrest --stanza=v_pgdata archive-get %f "%p"'/
> /
> /
> /barman_host='barman@barmansrv'/
> /barman_server='pg'/
>
> Not Sure /*restore_command *//is correct or not ?/

See comment above regarding "archive_command".


> Do we need to use inside repmgr.conf - _/*barman_host*='barman@barmanserver' and *barman_server*='pgnode/_' since I am not using Barman

No, these are not needed (if present they would be ignored anyway, unless you
were trying to clone a standby from Barman).


Regards

Ian Barwick



--
Ian Barwick https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Narayan Ubale

unread,
Jun 23, 2021, 4:07:29 PMJun 23
to repmgr
Hi  Ian ,

Thanks for 

I have configured with archive_command using pgbackrest. 

I have configured Single Master - 6 Node HA Cluster Replication on multi-(datacenter/region )/ (Prod and DR Site

Need help with 
  • Should we use 2 witness nodes (For each Datacenter) so if My whole one data center(Prod) goes down, then another data center will work perfectly?
  • will replication management will work Single master and 3 standby nodes? or will be there any lag?

| ID | Name            | Role            | Status    | Upstream      | Location | Priority | Timeline |
|---- |----------------         |---------         |-----------         |-------------                 |----------         |----------         |---------- |
|  1 | PG12-prod-db-1 | standby | running    | PG12-dr-db1 | PROD-DC  |      100 |        1 |
|  2 | PG12-prod-db2  | standby | running    | PG12-dr-db1 | PROD-DC  |      100 |        1 |
|  3 | PG12-prod-db3  | witness | * running | PG12-dr-db1 | PROD-DC  |        0 | n/a      |
|  4 | PG12-dr-db1    | primary | * running |                              | DR-DC    |      100 |        2 |
|  5 | PG12-dr-db2    | standby | running    | PG12-dr-db1 | DR-DC    |      100 |        2 |
|  6 | PG12-dr-db3    | witness | * running | PG12-dr-db1 | DR-DC    |        0 | n/a      |


Thanks 
Reply all
Reply to author
Forward
0 new messages