Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
postgresql_pgbackrest_configuration [2025/05/17 15:24] andonovjpostgresql_pgbackrest_configuration [2025/05/19 06:22] (current) – [Restore] andonovj
Line 15: Line 15:
 </Code> </Code>
  
-So in nutshell, my patroni.yml looks like this: 
  
-<Code:bash|Patroni Yaml> +After thatyou can configure the /etc/pgbackrest.conf file on all serversdb nodes + backup server
-scope: stampede  +
-name: ${host}  +
-  +
-restapi:  +
-  listen: ${host}:8008  +
-  connect_address: ${host}:8008  +
-  +
-etcd:  +
-  hosts: etcd00:2379etcd01:2379, etcd02:2379  +
-  +
-bootstrap: +
-  dcs: +
-    ttl: 30 +
-    loop_wait: 10 +
-    retry_timeout: 10 +
-    maximum_lag_on_failover: 1048576 +
-    maximum_lag_on_syncnode: 15000000 +
-    synchronous_mode: true +
-    postgresql: +
-      use_pg_rewind: true +
-      use_slotstrue+
  
-  initdb:  +<Code:bash|Pgbackrest Configuration> 
-  encoding: UTF8  +[global] 
-  data-checksums +repo1-path=/backups 
 +repo1-retention-full=14 
 +repo1-retention-full-type=time 
 +repo1-host-user=pgbackrest 
 +archive-check=n 
 +process-max=2 
 +log-level-console=info 
 +log-path=/backup/pgbackrest/log 
 +log-level-file=debug 
 +start-fast=y (performs a checkpoint) 
 +delta=y 
  
-  pg_hba:  +[cluster_backup] 
-  host replication rep_user ${subnet}.0/24 md5  +pg1-path=/db/pgdata 
-  - host all all ${subnet}.0/24 md5  +
- +
-postgresql:  +
-  listen: ${host}:5432  +
-  connect_address: ${host}:5432  +
-  data_dir: /db/pgdata  +
-  bin_dir: ${bindir} +
-  pgpass: /tmp/pgpass0  +
-  authentication:  +
-    replication:  +
-      username: rep_user  +
-      password: newpass  +
-    superuser:  +
-      username: postgres  +
-      password: newpass  +
-  parameters:  +
-    unix_socket_directories: '/var/run/postgresql'  +
-    external_pid_file: '/var/run/postgresql/17-main.pid'  +
-    logging_collector: "on"  +
-    log_directory: "/var/log/postgresql"  +
-    log_filename: "postgresql-17-main.log"  +
-    shared_buffers: 100MB +
-    work_mem: 16MB +
-    maintenance_work_mem: 10MB +
-    max_worker_processes: 16 +
-    wal_buffers: 16MB +
-    max_wal_size: 200MB +
-    min_wal_size: 100MB +
-    effective_cache_size: 50MB +
-    fsync: on +
-    checkpoint_completion_target: 0.9 +
-    log_rotation_size: 100MB +
-    listen_addresses: '*' +
-    max_connections: 2000 +
-    temp_buffers: 4MB +
-    archive_mode: "on" +
-    wal_level: "replica" +
-    archive_command: "pgbackrest --stanza=cluster_backup archive-push %p" +
-    restore_command: "pgbackrest --stanza=cluster_backup archive-get %f %p"+
 </Code> </Code>
  
Line 173: Line 122:
  
 Check if that is the correct state and if you are happy. Then promote it and THEN stop it: Check if that is the correct state and if you are happy. Then promote it and THEN stop it:
 +
 +<Code:bash | Promote the PostgreSQL>
 +/usr/pgsql-17/bin/pg_ctl promote -D /db/pgdata -w
 +</Code>
  
 <Code:bash | stopping outside of Patroni> <Code:bash | stopping outside of Patroni>
Line 188: Line 141:
 That is how I was able to make it work. I am 99.(9)8% (Math nerds here), sure I do something wrong, but still. If you cannot get it work with patroni initially, that way works. That is how I was able to make it work. I am 99.(9)8% (Math nerds here), sure I do something wrong, but still. If you cannot get it work with patroni initially, that way works.
  
- 
-=====Appendix===== 
-Configuration for pgbackrest on ALL servers: 
- 
-<Code:bash|Configuration> 
-[global] 
-repo1-path=/backups 
-repo1-retention-full=14 
-repo1-retention-full-type=time 
-repo1-host-user=pgbackrest 
-archive-check=n 
-process-max=2 
-log-level-console=info 
-log-path=/backup/pgbackrest/log 
-log-level-file=debug 
-start-fast=y (performs a checkpoint) 
-delta=y  
- 
-[cluster_backup] 
-pg1-path=/db/pgdata  
-</Code> 
- 
-FYI: https://pgbackrest.org/configuration.html#section-general/ 
  
  • postgresql_pgbackrest_configuration.1747495463.txt.gz
  • Last modified: 2025/05/17 15:24
  • by andonovj