postgresql: Decouple wal_g from streaming replication.

Streaming replication may be used even if `wal-g` is not -- as long as
the user can move a copy of the base backup to the replica (e.g. using
`pg_basebackup`).  Remove the warning about this combination, and move
the `primary_conninfo` setting outside of the `s3_backups_bucket`
check.
This commit is contained in:
Alex Vandiver 2024-04-03 17:27:58 +00:00 committed by Tim Abbott
parent 5121bff3c0
commit 92121a0626
5 changed files with 12 additions and 15 deletions

View File

@ -55,13 +55,6 @@ class zulip::profile::postgresql {
}
if $replication_primary != undef and $replication_user != undef {
if $s3_backups_bucket == '' {
$message = @(EOT/L)
Replication is enabled, but s3_backups_bucket is not set in zulip-secrets.conf! \
Streaming replication requires wal-g backups be configured.
|-EOT
warning($message)
}
# The presence of a standby.signal file triggers replication
file { "${zulip::postgresql_base::postgresql_datadir}/standby.signal":
ensure => file,

View File

@ -788,17 +788,18 @@ listen_addresses = <%= @listen_addresses %>
<% end -%>
<% if @s3_backups_bucket != '' -%>
# Streaming backups and replication
# WAL backups to S3 (may also be used for replication)
archive_mode = on
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
<% end -%>
<% unless @replication_primary.nil? || @replication_user.nil? -%>
# Streaming replication
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
'
<% end -%>
<% end -%>
<% unless @ssl_cert_file.nil? -%>
ssl_cert_file = '<%= @ssl_cert_file %>' # (change requires restart)

View File

@ -819,17 +819,18 @@ listen_addresses = <%= @listen_addresses %>
<% end -%>
<% if @s3_backups_bucket != '' -%>
# Streaming backups and replication
# WAL backups to S3 (may also be used for replication)
archive_mode = on
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
<% end -%>
<% unless @replication_primary.nil? || @replication_user.nil? -%>
# Streaming replication
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
'
<% end -%>
<% end -%>
<% unless @ssl_cert_file.nil? -%>
ssl_cert_file = '<%= @ssl_cert_file %>' # (change requires restart)

View File

@ -840,17 +840,18 @@ listen_addresses = <%= @listen_addresses %>
<% end -%>
<% if @s3_backups_bucket != '' -%>
# Streaming backups and replication
# WAL backups to S3 (may also be used for replication)
archive_mode = on
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
<% end -%>
<% unless @replication_primary.nil? || @replication_user.nil? -%>
# Streaming replication
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
'
<% end -%>
<% end -%>
<% unless @ssl_cert_file.nil? -%>
ssl_cert_file = '<%= @ssl_cert_file %>' # (change requires restart)

View File

@ -40,17 +40,18 @@ effective_io_concurrency = <%= @effective_io_concurrency %>
<% end -%>
<% if @s3_backups_bucket != '' -%>
# Streaming backups and replication
# WAL backups to S3 (may also be used for replication)
archive_mode = on
archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'
<% end -%>
<% unless @replication_primary.nil? || @replication_user.nil? -%>
# Streaming replication
primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>
<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>
<% unless @ssl_mode.nil? %> sslmode=<%= @ssl_mode %><% end -%>
'
<% end -%>
<% end -%>
<% unless @ssl_cert_file.nil? -%>
ssl_cert_file = '<%= @ssl_cert_file %>' # (change requires restart)