Skip to content

Commit

Permalink
Merge pull request #40 from jobscore/feat/add_more_configuration_options
Browse files Browse the repository at this point in the history
Add more postgres configuration options
  • Loading branch information
GlauberrBatista authored Sep 4, 2024
2 parents dbf4f69 + f411e40 commit 049cedc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
19 changes: 12 additions & 7 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ postgresql_src_dir: /usr/local/pgsql
postgresql_data_dir: "{{ postgresql_src_dir }}/data"
postgresql_archive_dir: "{{ postgresql_src_dir }}/archive"
postgresql_restore_dir: "{{ postgresql_archive_dir }}"
postgresql_archive_command: "test ! -f {{ postgresql_archive_dir }}/%f && cp %p {{ postgresql_archive_dir }}/%f"
postgresql_restore_command: "cp {{ postgresql_restore_dir }}/%f %p"
postgresql_primary_conninfo: ""

postgresql_effective_io_concurrency: 1
postgresql_min_wal_size: 80MB
postgresql_max_wal_size: 1GB
postgresql_wal_level: replica
postgresql_max_wal_senders: 3
postgresql_max_worker_processes: 8
postgresql_max_parallel_workers: 8
postgresql_max_parallel_maintenance_workers: 2
Expand All @@ -31,11 +36,11 @@ postgresql_config_params: >
# Configuration options
postgresql_max_connections: 100
postgresql_unix_socket_dir: /var/run/postgresql/
postgresql_shared_buffers: '8MB'
postgresql_work_mem: '4MB'
postgresql_maintenance_work_mem: '64MB'
postgresql_effective_cache_size: '4GB'
postgresql_random_page_cost: '4.0'
postgresql_max_standby_streaming_delay: '30s'
postgresql_shared_buffers: "8MB"
postgresql_work_mem: "4MB"
postgresql_maintenance_work_mem: "64MB"
postgresql_effective_cache_size: "4GB"
postgresql_random_page_cost: "4.0"
postgresql_max_standby_streaming_delay: "30s"
postgresql_autoprewarm_enabled: true
postgresql_dynamic_shared_memory_type: 'posix'
postgresql_dynamic_shared_memory_type: "posix"
10 changes: 5 additions & 5 deletions templates/postgresql.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ max_parallel_workers = {{ postgresql_max_parallel_workers }} # maximum number o

# - Settings -

wal_level = replica # minimal, replica, or logical
wal_level = {{ postgresql_wal_level }} # minimal, replica, or logical
# (change requires restart)
#fsync = on # flush data to disk for crash safety
# (turning this off can cause
Expand Down Expand Up @@ -237,7 +237,7 @@ checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0

archive_mode = on # enables archiving; off, on, or always
# (change requires restart)
archive_command = 'test ! -f {{ postgresql_archive_dir }}/%f && cp %p {{ postgresql_archive_dir }}/%f' # command to use to archive a logfile segment
archive_command = '{{ postgresql_archive_command }}' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
Expand All @@ -248,7 +248,7 @@ archive_command = 'test ! -f {{ postgresql_archive_dir }}/%f && cp %p {{ postgre

# These are only used in recovery mode.

restore_command = 'cp {{ postgresql_restore_dir }}/%f "%p"' # command to use to restore an archived logfile segment
restore_command = '{{ postgresql_restore_command }}' # command to use to restore an archived logfile segment
# placeholders: %p = path of file to restore
# %f = file name only
# e.g. 'cp /mnt/server/archivedir/%f %p'
Expand Down Expand Up @@ -289,7 +289,7 @@ recovery_target_timeline = 'latest' # 'current', 'latest', or timeline ID

# Set these on the master and on any standby that will send replication data.

max_wal_senders = 3 # max number of walsender processes
max_wal_senders = {{ postgresql_max_wal_senders }} # max number of walsender processes
# (change requires restart)
{% if postgresql_version | int < 13 %}
wal_keep_segments = 1280 # in logfile segments, 16MB each; 0 disables
Expand Down Expand Up @@ -318,7 +318,7 @@ wal_keep_size = 20480 # in megabytes; 0 disables

# These settings are ignored on a master server.

#primary_conninfo = '' # connection string to sending server
primary_conninfo = '{{ postgresql_primary_conninfo }}' # connection string to sending server
#primary_slot_name = '' # replication slot on sending server
#promote_trigger_file = '' # file name whose presence ends recovery
hot_standby = on # "off" disallows queries during recovery
Expand Down

0 comments on commit 049cedc

Please sign in to comment.