Skip to content

Commit

Permalink
Add patroni_standby_cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
vitabaks committed Aug 23, 2021
1 parent 709e934 commit 8b002d1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
18 changes: 14 additions & 4 deletions roles/patroni/templates/patroni.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,20 @@ bootstrap:
synchronous_mode: {{ synchronous_mode |string |d(false, true) |lower }}
synchronous_mode_strict: {{ synchronous_mode_strict |string |d(false, true) |lower }}
synchronous_node_count: {{ synchronous_node_count |d(1, true) |int }}
# standby_cluster:
# host: 127.0.0.1
# port: 1111
# primary_slot_name: patroni
{% if patroni_standby_cluster.host is defined and patroni_standby_cluster.host | length > 0 %}
standby_cluster:
host: {{ patroni_standby_cluster.host }}
port: {{ patroni_standby_cluster.port }}
{% if patroni_standby_cluster.primary_slot_name is defined and patroni_standby_cluster.primary_slot_name | length > 0 %}
primary_slot_name: {{ patroni_standby_cluster.primary_slot_name }}
{% endif %}
{% if patroni_standby_cluster.restore_command is defined and patroni_standby_cluster.restore_command | length > 0 %}
restore_command: {{ patroni_standby_cluster.restore_command }}
{% endif %}
{% if patroni_standby_cluster.recovery_min_apply_delay is defined and patroni_standby_cluster.recovery_min_apply_delay | length > 0 %}
recovery_min_apply_delay: {{ patroni_standby_cluster.recovery_min_apply_delay }}
{% endif %}
{% endif %}
postgresql:
use_pg_rewind: {{ patroni_postgresql_use_pg_rewind |string |d(false, true) |lower }}
use_slots: true
Expand Down
8 changes: 8 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ patroni_retry_timeout: 10
patroni_maximum_lag_on_failover: 1048576
patroni_master_start_timeout: 300

# https://patroni.readthedocs.io/en/latest/replica_bootstrap.html#standby-cluster
patroni_standby_cluster:
host: "" # an address of remote master
port: "5432" # a port of remote master
# primary_slot_name: "" # which slot on the remote master to use for replication (optional)
# restore_command: "" # command to restore WAL records from the remote master to standby leader (optional)
# recovery_min_apply_delay: "" # how long to wait before actually apply WAL records on a standby leader (optional)

patroni_log_destination: stderr # or 'logfile'
# if patroni_log_destination: logfile
patroni_log_dir: /var/log/patroni
Expand Down

0 comments on commit 8b002d1

Please sign in to comment.