From 9b27898a0dcd938264a20d967cd41ad69dccdae7 Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik <37010174+vitabaks@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:29:18 +0300 Subject: [PATCH] PgBackRest: Enable asynchronous WAL archiving (#515) --- roles/pgbackrest/tasks/main.yml | 12 ++++++++++++ vars/main.yml | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/roles/pgbackrest/tasks/main.yml b/roles/pgbackrest/tasks/main.yml index 819821318..8af4bb4d2 100644 --- a/roles/pgbackrest/tasks/main.yml +++ b/roles/pgbackrest/tasks/main.yml @@ -106,6 +106,18 @@ tags: pgbackrest, pgbackrest_install - block: + - name: Ensure spool directory exist + ansible.builtin.file: + path: "{{ item.value }}" + state: directory + owner: postgres + group: postgres + mode: "0750" + loop: "{{ pgbackrest_conf.global }}" + when: item.option == 'spool-path' + loop_control: + label: "{{ item.value }}" + - name: Ensure config directory exist ansible.builtin.file: path: "{{ pgbackrest_conf_file | dirname }}" diff --git a/vars/main.yml b/vars/main.yml index 6ed612d95..d59dd37b7 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -489,7 +489,7 @@ pgbackrest_repo_type: "posix" # or "s3", "gcs", "azure" pgbackrest_repo_host: "" # dedicated repository host (optional) pgbackrest_repo_user: "postgres" pgbackrest_conf_file: "/etc/pgbackrest/pgbackrest.conf" -# see more options https://pgbackrest.org/configuration.html +# config https://pgbackrest.org/configuration.html pgbackrest_conf: global: # [global] section - { option: "log-level-file", value: "detail" } @@ -504,6 +504,10 @@ pgbackrest_conf: - { option: "stop-auto", value: "y" } - { option: "resume", value: "n" } - { option: "link-all", value: "y" } + - { option: "spool-path", value: "/var/spool/pgbackrest" } + - { option: "archive-async", value: "y" } # Enables asynchronous WAL archiving (details: https://pgbackrest.org/user-guide.html#async-archiving) + - { option: "archive-get-queue-max", value: "1GiB" } +# - { option: "archive-push-queue-max", value: "100GiB" } # - { option: "", value: "" } stanza: # [stanza_name] section - { option: "pg1-path", value: "{{ postgresql_data_dir }}" }