Commit bafcce42 authored by Gabriel Mazetto's avatar Gabriel Mazetto 🕵🏻
Browse files

Added support to configure standby_clusters in patroni

parent b3ab23e5
---
title: Allow bootstrapping patroni Standby Cluster
merge_request: 4558
author:
type: added
......@@ -17,6 +17,12 @@ default['patroni']['use_pg_rewind'] = false
default['patroni']['use_slots'] = true
default['patroni']['replication_slots'] = {}
 
# Standby cluster replication settings
default['patroni']['standby_cluster']['enable'] = false
default['patroni']['standby_cluster']['host'] = nil
default['patroni']['standby_cluster']['port'] = 5432
default['patroni']['standby_cluster']['primary_slot_name'] = nil
# Global/Universal settings
default['patroni']['name'] = node.name
default['patroni']['scope'] = 'postgresql-ha'
......
......@@ -3,6 +3,7 @@ class PatroniHelper < BaseHelper
 
DCS_ATTRIBUTES ||= %w(loop_wait ttl retry_timeout maximum_lag_on_failover max_timelines_history master_start_timeout).freeze
DCS_POSTGRESQL_ATTRIBUTES ||= %w(use_pg_rewind use_slots).freeze
DCS_STANDBY_CLUSTER_ATTRIBUTES ||= %w(host port primary_slot_name).freeze
 
attr_reader :node
 
......@@ -63,6 +64,14 @@ class PatroniHelper < BaseHelper
dcs['slots'][slot_name] = parse_replication_slots_options(options)
end
 
if node['patroni']['standby_cluster']['enable']
dcs['standby_cluster'] = {}
DCS_STANDBY_CLUSTER_ATTRIBUTES.each do |key|
dcs['standby_cluster'][key] = node['patroni']['standby_cluster'][key]
end
end
dcs
end
 
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment